For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2006 > SED output problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SED output problem
lac

2006-05-23, 7:05 pm

Hi,

I have been trying to call SED from TCL using the exec function and it
behaves differently then if I called the same SED function from the
shell (command line).

I am trying to extract only certain lines from a file as follow:

sed -n '5,10p' $Filename

If I type this from the command line in ksh, I get what I expect, lines
5 to 10 are printed to standard output.

However, if I try to call that same function within TCL using exec,
nothing returns.

catch {exec ksh -c "sed '5,10p' $Filename"} content

I have tried not using -n on sed but then all the file gets printed to
standard output when called from command line with duplicates of lines
5 to 10. When I don't use the -n flag from withing TCL (with exec), all
the file is printed without duplicates of line 5 to 10.

Can someone help me with this? I don't understand what is happening
here?

Thank you,

lac

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com