Quote:
Originally Posted by
redoubtable
echo "aaaa,aaa,aa,aaaa,aaaa aa"|sed -e 's/a/c/g' | awk -F "," '{printf "%s;%s%s;%s;%s,%s\n", $1,$2,$3,$4,substr($5,0,4),substr($5,6,2)}'
I hope you can understand the code. Like I said with the code I already had gave you it was possible to change any field with appropriate tweaking.
not change the 'a' letter to 'c' like u mention above,.
and i modify to
echo "aaaa,aaa,aa,aaaa,aaaa aa" | awk -F "," '{printf "%s;%s%s;%s;%s,%s\n", $1,$2,$3,$4,substr($5,0,4),substr($5,6,2)}'
from ur code, it will
change
aaaa,aaa,aa,aaaa,aaaa aa
into
aaaa;aaaaa;aaaa;aaaa,aa
the result line length reduced,... it should be
aaaa;aaa,aa;aaaa;aaaa aa