insert a line with variables using sed


 
Thread Tools Search this Thread
Operating Systems AIX insert a line with variables using sed
# 8  
Old 04-02-2010
MySQL

Quote:
Originally Posted by pludi
  1. Please, use [CODE][/CODE] tags, not tags for code and listings
  2. Did you read the explanation in your other thread on how the quotes work?
a. I try to attention use CODE tags.Sometimes I can make mistake like everybody.Couldnt it?
b. Explanation isnt unneccessary for my solution.
Please look at the page sed.sf.net - The SED $HOME

Thanks @ygemici
Regards

edit by bakunin: actually pludi wasn't talking to you but to sugan, so your complaint looks a bit off the mark. Furthermore, it might be my general dullness, but i can't discern any meaningful from the sentence "explanation isn't unnecessary for my solution". Care to explain that? I also don't understand how the link to the sourceforge project is going to help the thread opener.

I'll give you the benefit of doubt that maybe your post was intended for another thread, where it might make perfect sense and was just erroneously posted here. Otherwise i would have to classify it as bordering on spam. Thanks for clarifying.


---------- Post updated 04-02-10 at 11:39 AM ---------- Previous update was 04-01-10 at 05:39 PM ----------

Quote:
Originally Posted by ygemici
a. I try to attention use CODE tags.Sometimes I can make mistake like everybody.Couldnt it?
b. Explanation isnt unneccessary for my solution.
Please look at the page sed.sf.net - The SED $HOME

Thanks @ygemici
Regards

edit by bakunin: actually pludi wasn't talking to you but to sugan, so your complaint looks a bit off the mark. Furthermore, it might be my general dullness, but i can't discern any meaningful from the sentence "explanation isn't unnecessary for my solution". Care to explain that? I also don't understand how the link to the sourceforge project is going to help the thread opener.

I'll give you the benefit of doubt that maybe your post was intended for another thread, where it might make perfect sense and was just erroneously posted here. Otherwise i would have to classify it as bordering on spam. Thanks for clarifying.
Dear bakunin

I am in server world from fifteen years.I am computer and system engineer.
I dont understand to your approach to me?

I dont have to explain anybody especially to suspicious approach persons.

Anyway I think the other people wants to see my explanation :

Code:
sed ${linenumber}i\ "Insert Your Line" file

${linenumber} --> value of linenumber same as $linenumber and i use to {} for sed i option to isolated from the expanded shell variable that is only differerence ..
I hope my explanation is enough..
Thanks for your precision
Have a nice day
Regards

Last edited by bakunin; 04-01-2010 at 12:27 PM..
# 9  
Old 04-02-2010
Quote:
Originally Posted by ygemici
a. I try to attention use CODE tags.Sometimes I can make mistake like everybody.Couldnt it?
The note about the code tags wasn't targeted at you, but a note to sugan, a new user. Just like bakunin pointed out.
Quote:
Originally Posted by ygemici
b. Explanation isnt unneccessary for my solution.
Which leads to the question: which solution? I've looked through the thread twice, and this is your very first post here. No solution given so far, so probably that's why you don't think an explanation is needed.
Quote:
Originally Posted by ygemici
I am in server world from fifteen years.I am computer and system engineer.
I dont understand to your approach to me?

I dont have to explain anybody especially to suspicious approach persons.
Kutlama, but on this forum it's not important how long you've been in the computing world, but how well you can solve a problem, communicate it, and maybe even educate inexperienced users. If you neglect to read a thread, and then start to post aggressive answers it is within our rights to reprimand you. And what are "suspicious approach persons"?

Quote:
Originally Posted by ygemici
Anyway I think the other people wants to see my explanation :

Code:
sed ${linenumber}i\ "Insert Your Line" file

Nice solution, only that it only works with GNU sed, and the thread starter is on AIX and doesn't have that version installed.
# 10  
Old 04-02-2010
MySQL

If I have mistake any i am sorry

Have a nice day everybody
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sed to find and append or insert on SAME line

Hi, $ cat f1 My name is Bruce and my surname is I want to use SED to find “Bruce” and then append “ Lee” to the end of the line in which “Bruce” is found Then a more tricky one…. I want to INSERT ….a string… in to a line in which I find sometihng. So example $ cat f2 My name is... (9 Replies)
Discussion started by: Imre
9 Replies

2. Solaris

sed insert into line 1 via script

Hi I am trying to run a sed command within a script..unfortunately it wasn't written on Solaris so doesn't work. Can anyone help with the correct coding please? It is: sed -i '1i ROWID;ORDER_ID;JOB_NAME;ORDER_TABLE' ${OUTFILE} (4 Replies)
Discussion started by: Grueben
4 Replies

3. UNIX for Dummies Questions & Answers

Using sed to insert at position x and then every interval y for each line

Thanks to help from Don Cragun in post 302924174, I'm off and getting into trouble on my own (finally) with sed. Here is my goal - insert \\r\n at the 60th character on each line and then every 76th character thereafter: Input:... (3 Replies)
Discussion started by: gusbrown
3 Replies

4. Shell Programming and Scripting

sed and awk to insert a line after a para

hi I am having a file like this ############################## mod1 ( a(ll) , b( c), try(o) , oll(ll) go(oo) , al(ll) mm(al) , lpo(kka) kka(oop) ); mod2 ( jj(ll) , c( kk), try1q(o1) , ofll(lll) gao(oo1) , ala(llaa) mmf(adl) , lddpo(kkad) kkda(oodp) );... (20 Replies)
Discussion started by: kshitij
20 Replies

5. Shell Programming and Scripting

sed - How to insert line before the first blank line following a token

Hello. I have a config file (/etc/my_config_file) which may content : # # port for HTTP (descriptions, SOAP, media transfer) traffic port=8200 # network interfaces to serve, comma delimited network_interface=eth0 # set this to the directory you want scanned. # * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies

6. Shell Programming and Scripting

sed insert new line does not update file

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

7. Shell Programming and Scripting

Insert @Line # - SED (non-GNU)

Just posted on another fellow's question using ed, but I wanted to know about doing it with sed on Unix. For example - I have a file of an unknown length, but I want to add a line after the shell declaration (Line 2). If possible, I'd like the example to be able to just substitute in a number and... (2 Replies)
Discussion started by: Vryali
2 Replies

8. Shell Programming and Scripting

Using sed to insert text file at first line

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

9. Shell Programming and Scripting

sed insert text at particular line

I know that sed -n '12p' file will print line 12 but how might I insert text to a specified line? thanks (2 Replies)
Discussion started by: action_owl
2 Replies

10. Shell Programming and Scripting

sed - how to insert chars into a line

Hi I'm new to sed, and need to add characters into a specific location of a file, the fileds are tab seperated. text <tab> <tab> text <tab> text EOL I need to add more characters to the line to look like this: text <tab> <tab> newtext <tab> text <tab> text EOL Any ideas? (2 Replies)
Discussion started by: tangentviper
2 Replies
Login or Register to Ask a Question