It is currently Tue, 07 Dec 2021 02:37:57 GMT



 
Author Message
 Line to long for sed?
In <2...@catseye.snide.com> d...@catseye.snide.com (Douglas R. Probst) writes:

As you deduced, it seems like it is a problem with the line being too long
for your implementation of sed. Try using gawk/nawk which does not have this
restriction, viz.,

gawk '{ gsub(">1MIL","9999",$0); print }' oldfile > newfile

which does the same thing as

sed 's/>1MIL/9999/g'

                                    Regards,
                                       Gora



 Mon, 15 Dec 1997 03:00:00 GMT   
 Line to long for sed?

 Hi!
        I have a file that contains a single string of data about
5500 char long.
In the string is the pattern >1MIL  I need to change the pattern because
it can not be inserted into the database as is.
I have tried sed 's/\>1MIL/9999/g' oldfile > newfile
I have tried sed 's/>1MIL/9999/g' oldfile > newfile
I have tried sed s/\>1MIL/9999/g oldfile > newfile
I have tried sed s/>1MIL/9999/g oldfile > newfile
I have tried sed /">1MIL"/s/"9999"/g oldfile > newfile
I have tried sed /"\>1MIL"/s/"9999"/g oldfile > newfile

Newfile is always empty.

Any ideas???????
Thanks in advance
Doug
k

--
Doug
--------------------------------------------------------------------------------
Douglas Probst @ catseye (Home of the crazy cat lady) - Upper Darby, PA
                INTERNET: d...@catseye.pha.pa.us



 Mon, 15 Dec 1997 03:00:00 GMT   
 Line to long for sed?

: >  I have a file that contains a single string of data about
: >5500 char long.

: As you deduced, it seems like it is a problem with the line being too long
: for your implementation of sed. Try using gawk/nawk which does not have this
: restriction, viz.,

Two things:

: I have tried sed 's/\>1MIL/9999/g' oldfile > newfile

1) I tried it on a SMALL file and it didn't work either, until I added
   an extra ">". See session following:

Script started on Thu Jun 29 09:42:00 1995

[tad] /home/tad> cat >oldfile
stuff>1MILotherstuff
^D

[tad] /home/tad> sed 's/\>1MIL/9999/g' oldfile > newfile
[tad] /home/tad> cat newfile
stuff>1MILotherstuff

[tad] /home/tad> sed 's/\>>1MIL/9999/g' oldfile > newfile
                         ^
[tad] /home/tad> cat newfile
stuff9999otherstuff

[tad] /home/tad> exit
exit

script done on Thu Jun 29 09:43:20 1995

I have no idea why this works. Anyone care to enlighten me?

2) man sed says:

     Output line too long.
          An output line was longer than 4000 characters long.

     Hold space overflowed.
          More than 4000 characters were to be stored in the hold
          space.

is this the limit that is being exceeded?

--
|-------------------------------------------------------------------|
| Tad McClellan,      Logistics Specialist (IETMs and SGML guy)     |
|                     Lockheed Martin Tactical Aircraft Systems     |
|                     voice: (817) 763-6314                         |
|                     email: mcclella...@lfwc.lockheed.com          |
|-------------------------------------------------------------------|
| Money isn't everything ...                                        |
|                                                                   |
| but it's way ahead of whatever's in second place.                 |
|-------------------------------------------------------------------|



 Mon, 15 Dec 1997 03:00:00 GMT   
 Line to long for sed?
) : I have tried sed 's/\>1MIL/9999/g' oldfile > newfile
[...]
) [tad] /home/tad> sed 's/\>>1MIL/9999/g' oldfile > newfile
)                          ^
[...]
) I have no idea why this works. Anyone care to enlighten me?

\< and \> mean "beginning of word" and "end of word" in some
regular expression engines, such as sed's.  Just use:

    sed 's/>1MIL/9999/g' oldfile > newfile

This confusion is why Perl is consistant that "\" before
punctuation *always* matches the punctuation.  Repent your
sed use and convert to the one true program, Perl!
--
Tye McQueen                 t...@metronet.com  ||  t...@doober.usu.edu
             Nothing is obvious unless you are overlooking something



 Thu, 18 Dec 1997 03:00:00 GMT   
 
   [ 4 post ] 

Similar Threads

1. : split lines in long 'sed'-pattern ?

2. to all sed hackers - joining lines with sed

3. Command line: How long is too long?

4. SED / Line / (Need to get data from searched line from specific char to char)


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software