Search Results

Search: Posts Made By: spari2
18,427
Posted By rdcwayx
Is this complicated for you or not? for file in...
Is this complicated for you or not?
for file in file*
do
sed -i "1 s/^/`wc -l $file`\n/" $file
done
18,427
Posted By munkeHoller
here's one way ..... for file in *.x; do ...
here's one way .....

for file in *.x; do
wc -c $file | awk '{printf("%ld,%s\n",$1,$2)}' > ${file}.temp && cat ${file} >> ${file}.temp && mv ${file}.temp ${file};
done
18,427
Posted By chedlee88-1
Re: Adding header and trailer into a file
#!/bin/sh

for i in filelist*
do
NUMCHAR=`cat $i | wc -c`
echo "ABC,$NUMCHAR" >${i}.new
cat $i >>${i}.new
done


Video tutorial on how to use code tags in The UNIX and Linux...
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 08:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy