10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to do something like sed -n '/PATTERN/,+10p' and get the ten lines following PATTERN. However, this throws an "expected context address" with the sed that comes with OSX Lion. If that + is a GNUism, can I do this, or do I have to find another tool? (2 Replies)
Discussion started by: jnojr
2 Replies
2. Shell Programming and Scripting
This i will print the second line of a file
sed -n '2p' test2
The use of a variable is impossible here.
a=1
while ; do
line=`sed -n '$a p' test2`
# do some things here with the line variable
a=`expr $a + 1`
done
But the uotput of sed command is 'p'..... What can i do to use a variable... (2 Replies)
Discussion started by: hakermania
2 Replies
3. Shell Programming and Scripting
Hello!
Im trying to read file contents. Then, print out every line that has "/bens/here" in the file that was read.
cat /my/file.now | sed '/bens/here/p'
I keep getting the error asking if I need to predeclare sed?
What does predeclaring sed mean?
Thanks!
Ben (2 Replies)
Discussion started by: bigben1220
2 Replies
4. Shell Programming and Scripting
Hi,
I have a config_file.cfg with the content:
FILE_ID_1=1
FILE_FTP_ID_1=<FTP_SERVER1.COM>
....
FILE_ID_2=2
FILE_FTP_ID_2=<FTP_SERVER2.COM>
....
so on for 28 times.
As you might have guessed it; the script I have to write is to read this config file and get the FTP server... (3 Replies)
Discussion started by: dips_ag
3 Replies
5. Shell Programming and Scripting
Hello ,
I have huge file with below content. I need to read the numeric values with in the paranthesis after = sign. Please help me with awk and sed script for it.
11.10.2009 04:02:47 Customer login not found: identifier=(0748502889) prefix=(TEL) serviceCode=().
11.10.2009 04:03:12... (13 Replies)
Discussion started by: rmv
13 Replies
6. Shell Programming and Scripting
I have a variable called PATH that contains a path
example: /Users/rtipton/Desktop/testusers/test
I need a sed command to set a variable called USER to the last directory name in that path
PATH="/Users/rtipton/Desktop/testusers/test"
and from that PATH i need USER to = test
I know sed... (4 Replies)
Discussion started by: tret
4 Replies
7. Shell Programming and Scripting
Hi
I need some help on SED command
I am writing a shell script which does the following:
1. Read one line at a time from a file abc.txt which has millions of lines
2. Prefix each line read with some text "
3. Post fix each line read with a quote "
4. Write the new modified... (11 Replies)
Discussion started by: gaurav_1711
11 Replies
8. Shell Programming and Scripting
I have a bash script which produces the desired output (mostly).
tempTxt=`sed -n '79,/^$/p' <sourceFile.txt | cut -c 13-19`
What this produces is the text from the 79th line of the source file and cuts the text to the 13th through the 19th chars.
Then the script does the same thing... (4 Replies)
Discussion started by: roninuta
4 Replies
9. Shell Programming and Scripting
Not sure why my sed script is not working..need extra eyes..Any help would be aprreciated.
I want to add this line into the 1rst line of the $EJECT FILE
sed '/">>>>>>>>>>>>> TAPES TO BE EJECTED /a\<<<<<<<<<<<<<<<<<"'> $EJECT
This is the error message I get:
+ sed /">>>>>>>>>>>>> TAPES TO... (1 Reply)
Discussion started by: gzs553
1 Replies
10. Shell Programming and Scripting
This is likely to be a dumb one.
How can I use sed to substitute string occurances having it read from an input file and write to this very same file ?
I have a file with lots of occurances of '2006', I want to change it to '2007', but I'd like these changes to be saved on the input file.
... (5 Replies)
Discussion started by: 435 Gavea
5 Replies