Wednesday, February 1, 2023

Finding files that consist empty lines and concat

grep  -l ^$ filename | xargs -i cp {} tmp1/        # find files if file consist empty line(s)

for fname in tmp1/aero* ; do echo $fname ; purefile=`echo $fname|awk -F "/" '{print $2}'`; cat $fname |awk '{print}' ORS=' ' > tmp2/$purefile ; done        # deletes empty line and copies to another directory

No comments: