sed script files

sed script files

Post by cgopa.. » Sun, 09 Jul 2000 04:00:00



Hi :
I have a question with sed script files. I have a script file that is
700 lines long . Sed doesnt take in more than 200 line long script files
- so i split the sed.cmds into 4 smaller files. But now, sed refuses to
take in multiple script files.

If I give something like

sed -f s.cmds* blahblah.sdl

where there are s.cmdsaa and s.cmdsab files in the directory.
it tries to run s.cmdsaa on s.cmdsab and blahblah.sdl but doesnt take in
s.cmdsab as a script file. Is there a way to do this ?  I would
appreciate if some one could help me fast !

Thanks a ton

--Mouli

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

sed script files

Post by Richard Amic » Sun, 09 Jul 2000 04:00:00



> If I give something like

> sed -f s.cmds* blahblah.sdl

> where there are s.cmdsaa and s.cmdsab files in the directory.
> it tries to run s.cmdsaa on s.cmdsab and blahblah.sdl but doesnt take in
> s.cmdsab as a script file. Is there a way to do this ?  I would
> appreciate if some one could help me fast !

The -f option interprets just the next argument as a command file, so if you
want more than one command file, you must have more than one -f option, as
in

sed -f s.cmdsaa -f s.cmdsab ....

 
 
 

sed script files

Post by Ken Pizzi » Tue, 11 Jul 2000 04:00:00



>I have a question with sed script files. I have a script file that is
>700 lines long . Sed doesnt take in more than 200 line long script files
>- so i split the sed.cmds into 4 smaller files. But now, sed refuses to
>take in multiple script files.

>If I give something like

>sed -f s.cmds* blahblah.sdl

>where there are s.cmdsaa and s.cmdsab files in the directory.

So, after the shell does its filename expansions, sed will see
the command line:
  sed -f s.cmdsaa s.cmdsab s.cmdsac s.cmdsad blahblah.sdl
and interprets only the file named immediately after the "-f"
as the name of a sed script, and the remaining files as inputs
(as you discovered).

Then if you change that to:
  sed -f s.cmdsaa -f s.cmdsab -f s.cmdsac -f s.cmdsad blahblah.sdl
you wind up with a single 700 line sed script, that just happens
to reside in four seperate files.  No win there.

If your four s.cmdsa? files are self-contained sed scriptlets
(without, say, splitting a command block across file boundaries
or the need to do inter-file branching) then you could:
  sed -f s.cmdsaa blahblah.sdl | sed -f s.cmdsab |
    sed -f s.cmdsac | sed -f s.cmdsad

Perhaps a better option is to switch to a sed which does not
have such an arbritrary restriction on the number of statements
in a script, such as GNU sed.

                --Ken Pizzini

 
 
 

1. . sed script offered, sed script wanted

I
sed script to remove a leading comma from one line,
to the end of the preceding line (where it should b)
sed "N;s/\(.*\)\n,\(.*\)/\1,\n\2/" datafile

II
given a book, divided into huge chapters ( too big for some sed buffers )
how can you (sans sh, awk, perl) extract the chapters that contain
PATTERN ?

--
al aab
seders cooridinator
a free-for-all sed group
ask me about seders

--

2. Multiple NIC's - Newbie

3. . sed script dc greg ubben sed stud

4. problem in accessing dos partitions

5. sed problem: using sed in a shell script

6. Help identify this multi-IO IDE card!

7. Sed: Create a Make dependancy list (My First Sed Script)

8. perl DBD::ODBC / pthread

9. replace a single string in multiple files w/ a shell script + sed

10. a SED script to find length of the longest line in a file

11. Help with file searching script using sed

12. sed: replace regex, write new file; call from script -- How?

13. sed or awk script to remove escape codes from a text file