- or download this
#!/usr/bin/perl -w
open(SOURCE, "30.txt") || die "Cannot open: $!";
...
open(DEST, ">>newfile.txt") or die "Can't open new.cfg: $!";
print DEST @line;
close(DEST);
- or download this
This is what 30.txt looks like
big.script.sh
onetime.scrip.sh
...
scriptbb.sh
scriptbb.1.sh
scriptbb.2.sh
- or download this
This is what searchfile.txt looks like
file="^billing.file*" id=none synccmd="/foo/bin/scriptbb2.sh
+ %P %D %F"
file="^pay.file*" id=none synccmd="/foo/bin/pay.sh %P %D
+ %F"
...
file="^done.file*" id=none synccmd="/foo/bin/donethis.sh
+%P %D %F"
file="^cement.file*" id=none synccmd="/foo/bin/cement.sh %P
+ %D %F"
file="^animal.file*" id=none synccmd="/foo/bin/scripta.sh %
+P %D %F"
- or download this
This is what @line shoud look like after the grep
file="^car.file*" id=none synccmd="/foo/bin/big.script.s
+h %P %D %F"
...
file="^garage.file*" id=none synccmd="/foo/bin/scripta.1.sh
+ %P %D %F"
file="^tree.file*" id=none synccmd="/foo/bin/scriptbb.1.s
+h %P %D %F"
file="^foo.file*" id=none synccmd="/foo/bin/scriptbb.2.s
+h %P %D %F"