10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to identify the exact text of San Antonio Generator Running in the output my script which lands to a text file. Once SED finds the specific text, I need it to insert one line above the matched text.
Here is what I have so far that isn't working all that well for me. Any help would be... (7 Replies)
Discussion started by: jbrass
7 Replies
2. Shell Programming and Scripting
hi guys,
im trying to add the following line in my xml file
<dbrollbacksegs <oa_var="s_db_rollback_segs">NOROLLBACK</dbrollbacksegs>
when ever i find the following line
<dbsharedpool oa_var="s_dbsharedpool_size">300000000</dbsharedpool>
I have succedded till adding a new line... (1 Reply)
Discussion started by: smarlaku
1 Replies
3. Shell Programming and Scripting
help
i need to add a "nfsd" in new line after cron
ex:
cron
rpcbind
output:
cron
nfsd
rpcbind
i use
sed -e "/cron/G; s/$/nfsd/" myfile
output:
cron
nfsd
rpcbindnfsd (5 Replies)
Discussion started by: jamilzain
5 Replies
4. Shell Programming and Scripting
I need help with insert text to the last line of text file with echo command
I know can do something like echo "i4\n$logtext\n.\nwq" | ex -s $file can insert to first line, but how can i change this code in order to insert to the last line of text file?
please help, thank you :( (2 Replies)
Discussion started by: gavin_L
2 Replies
5. 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
6. 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
7. UNIX for Advanced & Expert Users
Problem: I have a lot of files, the files first line should always have 4 spaces before any text. Occasionally some of the files will miss the leading spaces and it's a problem. This is only in the first line.
So if there are 4 spaces then text, do nothing. If there are not 4 spaces, add 4... (2 Replies)
Discussion started by: Vryali
2 Replies
8. Shell Programming and Scripting
what is the sed command to remove the first two characters of every line of a text file?
each line of the text file has the same amount of characters, and they are ALL NUMERIC. there are hundreds of lines though.
for example,
>cat file1.txt
10081551
10081599
10082234
10082259
20081134... (20 Replies)
Discussion started by: ajp7701
20 Replies
9. Shell Programming and Scripting
I am trying to add a line of text just before the last line in a file.
For example, if the last line of a file is "exit 0", I need to add a line of text just before that.
Any ideas how I might do that?
Thanks (5 Replies)
Discussion started by: TheCrunge
5 Replies
10. Shell Programming and Scripting
I know that this my be really simple, but I'm having a hard time accomplishing it. I am trying to add a new line of text after finding a particular string of text in a file. Here's what I'm getting:
sed: command garbled: N/search_string/\\new_text/
I was using "N" to add a line after the... (3 Replies)
Discussion started by: douknownam
3 Replies