Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- perl one-liner question: add file into text.
May 13, 2005, 6:44 pm
rate this thread
I think perl should have the same ability to do this, but just not sure
how. Any help is welcomed!!!
Directory A (/home/dir_a) have these files:
file_A, file_B, file_C.
Directory B (/home/dir_b) have the corresponding notes:
file_A_note, file_B_note, file_C_note.
To append file_X_note into file_X at the end of the line
"Put_Note_Here" in file_A:
I know foreach + sed can do this with:
In dir_A: use
foreach f (*)
Can any one help to show how can I use perl one-liner ( and/or shell
"foreach" ) to achieve the same function? (No offend to sed lover, but
I just prefer using perl... )
Re: perl one-liner question: add file into text.
I know this one. Yay!
#! /usr/bin/perl -w
my $destdir = shift or die "ugh: $!";
my $shcmd =<<NED;
for file in *
if [ -f $file ]
cat $file >> $destdir/$file