I have a directory with around 100k files and files with varying sizes(10GB files to as low as 5KB). All the files are having pipe dilimited records.
I need to append 7 pipes to the end of each record, in each file whose name contains _X3_ and need to append 10 pipes to the end of each record, in each file whose name contains _X7_.
I tried as below but it doesnt work, it changes for all files
for file in *
do
{
awk '{printf "%s,\"%s\"\n",$0,"|||||||"}' "$file"
} > output && mv output "$file"
done
Thank You in advance
.
---------- Post updated at 12:57 PM ---------- Previous update was at 12:40 PM ----------
Thank you Franklin. Will use the Code tag in future.
for file in *_X7_*
do
awk '{print $0"|||||||"}' $file> output
mv output $file
done
for file in *_X3_*
do
awk '{print $0"|||||||"}' $file> output
mv output $file
done
any better way?
Also I have multiple level of directories with each directory. I need to do the change in each and every directory where i can find a file with the filename having _X7_ or _X3_