Operating System - HP-UX
1834189 Members
2647 Online
110064 Solutions
New Discussion

Manipulating file with one single big line

 
SOLVED
Go to solution
Andres_13
Respected Contributor

Manipulating file with one single big line

Hi there,

I have two problems here:

The first one is that I need to deal with a file with just one big line (see attachment) and ain't able to manipulate it with ed, ex, vi, view and so on. I think perl would be a good option but I don't know it...

The second one is that I need to replace every ocurrence of "2AU" string with the newline character, I think is "\n" and tried as follows:

cd $DIR
cat - << EOF | ed -s MyFile
1,$ s?2AU?\n?g
w MyFile
q
EOF

which actually isn't working....

Any help will be appreciated.

Regards!
3 REPLIES 3
Andres_13
Respected Contributor

Re: Manipulating file with one single big line

I forgot to mention that the attached file is a sample because the original is over 15 MB and the max size ITRC forums can deal with is 1 MB...

In fact with that size vi gives me a "Line too long" error and nothing is shown...

Regards!
James R. Ferguson
Acclaimed Contributor
Solution

Re: Manipulating file with one single big line

Hi Andres:

Perl lacks arbitrary limits, so:

# perl -pe 's/2AU/\n/g' file

Regards!

...JRF...
Andres_13
Respected Contributor

Re: Manipulating file with one single big line

Thanks James!!

Perl did the trick as James posted...