10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Team,
I am facing a problem as under, Suppose I have a file (test.txt) with the below content (all braces and slashes are included in the contents of the file)
Now I want to append few words below matched line, I have written the below sed:
sed '/option/a insert text here' test... (2 Replies)
Discussion started by: ankur328
2 Replies
2. Shell Programming and Scripting
Hi Guys!
Unix newbie here!
Have a requirement for which I have been scouting the forums for a solution but has been out of luck so far :(
I have a file which contains the following:-
TEST1|TEST2|"TEST3|1@!2"|TEST5
My sed command should result in either one the following output:-... (6 Replies)
Discussion started by: hishamzz
6 Replies
3. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
4. UNIX for Dummies Questions & Answers
Hi I just wanted to add a new line after every matching pattern:
The method doing this doesn't matter, however, I have been using sed and this is what I tried doing, knowing that I am a bit off:
sed 'Wf a\'/n'/g'
Basically, I want to add a new line after occurrence of Wf. After the line Wf... (5 Replies)
Discussion started by: MIA651
5 Replies
5. Shell Programming and Scripting
Hi
I have written a shell script which used sed code below
sed -i 's/'"$Pattern"'/ /g' $FileName
I want to count the length of Pattern and replace it with equal number of spaces in the FileName.
I have used $(#pattern) to get the length but could not understand how to replace... (8 Replies)
Discussion started by: rakeshkumar
8 Replies
6. Shell Programming and Scripting
I couldn't figure out how to use sed or any other shell to do the following. Can anyone help? Thanks.
If seeing a string (e.g., TODAY) in the line,
replace a string in the line above (e.g, replace "Raining" with "Sunny")
and replace a string in the line below (e.g., replace "Reading" with... (7 Replies)
Discussion started by: sprinner
7 Replies
7. Shell Programming and Scripting
I inherited a script that contains the following sed command:
sed -n -e '/^.*ABCD|/p' $fileName | sed -e 's/^.*ABCD|//' | sed -e 's/|ABCD$//' > ${fileName}.tmp
What I'm wondering is whether ABCD has a special pattern matching value in sed, such as a character class similar or identical to .
... (9 Replies)
Discussion started by: topmhat
9 Replies
8. Shell Programming and Scripting
Hi All,
I have a requirement where I have to find a pattern in a file and comment the whole line containing the search pattern. Any ideas in shell is welcome.
Thanks in advance,
Regards,
Arun (3 Replies)
Discussion started by: arun_maffy
3 Replies
9. Shell Programming and Scripting
This is my first post, please be nice. I have tried to google and read different tutorials.
The task at hand is:
Input file input.txt (example)
abc123defhij-E-1234jslo
456ujs-W-abXjklp
From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies
10. Shell Programming and Scripting
Hello All,
I have a string "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031", and I just want to extract LLSV1, but I dont get the expected result when using the sed command below.
# echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" | awk '{print... (4 Replies)
Discussion started by: racbern
4 Replies