in reply to Re^2: problem with deleting a row
in thread problem with deleting a row
This one slurps the whole file with the angle brackets, passes it through grep to filter the output which gets printed to the output file. Note the exclamation mark in front of the regex. It's the "not" operator which says you don't want the matching lines in your output.#!/usr/bin/perl -w use strict; use autodie; my ($user_file, $changed_file) = qw{test.txt test.txt.mod}; open my $in_fh, '<', $user_file; open my $out_fh, '>', $changed_file; print "Which user? "; my $user = <STDIN>; chomp $user; print $out_fh grep !/^$user,/, <$in_fh>;
Keep working at it. From the long list of replies, you've certainly piqued the Monks' interest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: problem with deleting a row
by Laurent_R (Canon) on Nov 23, 2013 at 16:56 UTC |