Search Results

Search: Posts Made By: dondilip
25,285
Posted By itkamaraj
bash-3.2$ cat test.txt abc,2,one,test ...
bash-3.2$ cat test.txt
abc,2,one,test
abc,3,one,test
abc,10,one,test
abc,5004,one,test
abc,100,one,test
abc,5004,one,test
abc,101,one,test
bash-3.2$ nawk -F, -v OFS=,...
25,285
Posted By itkamaraj
for i in *.txt do awk -F, -v OFS=,...
for i in *.txt
do
awk -F, -v OFS=, '$2==2{$2=1;print $0}' $i > $i.out
mv $i.out $i
done
25,285
Posted By rangarasan
awk
No, i think. Instead of giving *csv in awk. Use loop around your awk.

for files in *csv
do
awk '{print FILENAME;}' $files
done

do your options inside awk.
Cheers,
Ranga:-)
25,285
Posted By rangarasan
awk
Hi,

Try this,


awk -F, -v OFS=, '$2==2{$2=1;a[NR]=$0;}END{for(i=1;i<=NR;i++){print a[i] >FILENAME;}}' input_file


FILENAME - give you the input file name.

Cheers,
Ranga:)
25,285
Posted By itkamaraj
try my suggestion in the #4 post $ sed...
try my suggestion in the #4 post


$ sed 's/,\([0-9]*\),/,1010,/' input.txt
9788691010,1010,20120120002804,
9705645060,1010,20120120004753,
9014961516,1010,20120120004809,



----------...
Showing results 1 to 5 of 5

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