I have a file with contents
"08011"||20080812
"23348"|20080827|20080924
"23387"|20080829|20080915
"23581"|20081003|20081028
"23748"|20081017|20090114
"24095"|20080919|20081013
"24105"|20070723|20070801
"24118"|20080806|20081013
"24165"|20080820|20080912
"24221"|20080908|20080929
i want to write 10 blanks in case 2 pipes are coming together in the file.
Please help using awk script
CarloM
2
sed 's/||/| |/g' inputfile
Or if you really want to do it in awk:
awk -F"|" '{ for (i=1;i<=NF;i++) { if ($i=="") { $i=" " } } OFS="|";print }' inputfile
or
awk '{gsub ("\\|\\|", "| |"); print}' inputfile
$ sed 's/\|\|/\| \|/' test
"08011"| |20080812
"23348"|20080827|20080924
"23387"|20080829|20080915
"23581"|20081003|20081028
"23748"|20081017|20090114
"24095"|20080919|20081013
"24105"|20070723|20070801
"24118"|20080806|20081013
"24165"|20080820|20080912
"24221"|20080908|20080929
danmero
4
awk 'BEGIN{FS=OFS="|"}{for(i=1;++i<NF;)$i=$i?$i:" "}1' file