line too long using awk or sed or tr
line too long using awk or sed or tr
goodmorning,
i have mks toolkit (k-shell) running on a windows server. on it i have a c program that in a true unix environment works fine, but here it adds an extra '0000000000000016000a' in various places in the file that the c program produces that i need to remove.
here is what the file looks like when i pg it:
code:
00000000000000840022003a00013a40313a98263a013af63af2423af03af2423af03a13043a0705163a08233a20513af03a f53a113af0
00000000000000840022003a00013a26983a98273a013af73af4903af03af4903af03a26983a0705163a12063a20493af03a f73af63af0
00000000000000840022003a00013a26983a98283a013af53af1073af03af1073af03a26983a0705163a13283a20483af03a f13a123af0
note that the length of the line exceeds the width of the screen and pg simply does not display the rest of the line; this file shows 17 very long lines.
from the windows environment, here is what it looks like when i use notepad:
code:
000000000000004c0022163a000000003a00013af03af03af03af6103a08023a070516220a
0000000000000016000a
000000000000004c0022163a000000003a00033af03af03af03af6083a08033a070516220a
0000000000000016000a
000000000000004c0022163a000000003a00043af03af03af03af6073a08043a070516220a
0000000000000016000a
000000000000004c0022163a000000003a00023af03af03af03af6073a08063a070516220a
0000000000000016000a
000000000000004c0022163a000000003a00013af03af03af03af6093a08123a070516220a
so i have tried sed:
code:
sed '/0000000000000016000a/d' tl000110.ip.out > new.out
and i get a zero byte new.out. i have tried this identical sed command on a simple text file where i put '00123' strewn throughout and it worked fine.
i tried awk:
code:
awk '{gsub("0000000000000016000a","",$0)}' tl000110.ip.out > new.out
and i get this message:
code:
awk: line 0 (nr=0): line too long: limit 20000
i tried using tr, but i could only ever get it to work on a character by character basis, so when i asked for it to delete '0000000000000016000a' it also removed all instances of the numbers 0,1,6 and the letter a.
can anyone here think of a way to remove these errant entries from this file that has long lines?
thanks for the help!
|