09-18-2015
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies
2. Shell Programming and Scripting
I want to delete a line between selected lines using sed:
e.g. : Between "bus" to "pins", delete lines conaining "signal" word.
Input :
bus
direction
signal new
signal old
pins
signal ok
end
Desired Output:
bus
direction
pins
signal
end (4 Replies)
Discussion started by: nehashine
4 Replies
3. Shell Programming and Scripting
I can't seem to get sed to allow me to insert text in the first line of an empty file. I have a file.txt that is a 0 byte file. I want sed to insert " fooBar" onto the first line. I've tried a few options and nothing seems to work. They work just fine if there's text in the file tho. Help? (4 Replies)
Discussion started by: DC Slick
4 Replies
4. Shell Programming and Scripting
sed '1r file.txt' <source.txt >desti.txt
This example will insert 'file.txt' between line 1 and 2 of source.txt.
sed '0r file.txt' <source.txt >desti.txt
gives an error message.
Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Discussion started by: psve
18 Replies
5. Shell Programming and Scripting
Greetings all,
I am trying to match a string, and after that insert a few lines above that match.
The string is "Version 1.0.0". I need to insert a few lines ONLY above the first match (there are many Version numbers in the file). The rest of the matches must be ignored. The lines I need to... (2 Replies)
Discussion started by: nagaraj s
2 Replies
6. Shell Programming and Scripting
How can I insert the command executed on the shell into the first line of my output file?
For example if I execute;
zcat *.gz |grep “User5501” > users.out
How can I make my users.out look like;
zcat *.gz |grep “User5501” > users.out
User5501 PA
User5501 UA
User5501 ZA... (3 Replies)
Discussion started by: lewk
3 Replies
7. Shell Programming and Scripting
hi I am trying to use SED to replace the line matching a pattern using the command
sed 'pattern c\
new line
' <file1 >file 2
I got two questions
1. how do I insert a blank space at the beginning of new line?
2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies
8. Shell Programming and Scripting
Hi
I've been trying to search but couldn't quite get the answer I was looking for.
I have a a file that's like this
Time, 9/1/12
0:00, 1033
0:10, 1044
...
23:50, 1050
How do I make it so the file will be like this?
9/1/12, 0:00, 1033
9/1/12, 0:10, 1044
...
9/1/12, 23:50, 1050
I... (4 Replies)
Discussion started by: diesel88
4 Replies
9. Shell Programming and Scripting
Hi all,
I have a file called "text.cpp" with the first line of "1"
afterwards I tried in Ubuntu to type the following
sed '12iasdasdasdasdsad' test.cpp > output.txt
however when I tried to see the result of output.txt
#cat output.txt
1
why is the line 12 is not updated to the... (6 Replies)
Discussion started by: peuceul
6 Replies
10. Shell Programming and Scripting
Dear all,
i am having text file like below
surya
rama
ranga
laxman
rajesh
reddy
i want add string (OK) before a text from line 3 to 5
the result will be
surya
rama
OK ranga
OK laxman
OK rajesh
reddy (1 Reply)
Discussion started by: suryanarayana
1 Replies