Shell append or insert


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell append or insert
# 1  
Old 10-16-2008
Question Shell append or insert

Is there a way to append or insert a word into a text file?

for example:

if a file contains the lines......

profilename="test_profile"
ear="${WpsInstallLocation}/installableApps/"
conntype="SOAP"

What I would like to have is the word test.ear inserted as below.....

profilename="wp_profile"
ear="${WpsInstallLocation}/installableApps/test.ear"
conntype="SOAP"

Is this possible?
# 2  
Old 10-16-2008
What have you attempted so far and what you're having trouble with?

Regards
# 3  
Old 10-16-2008
PHP

How about this, assuming you need to append stuff at 2nd line.

sed '2 s|"$|test.ear&|' < file.txt
# 4  
Old 10-16-2008
I have tried using sed and awk but itīs not working as I am finding it difficult to single out the one line.
# 5  
Old 10-16-2008
cool thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help on Oracle insert from shell script

Hi All I am trying to create a shell script to insert in to oracle table so far insert happens with out an issue, but i cant pass message variable to sqlplus script insert. i have highlighted the variable in red. Please help. thanks in advance. #!/bin/sh df -H | grep -vE... (3 Replies)
Discussion started by: LPK
3 Replies

2. 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

3. Shell Programming and Scripting

Append color in shell script for output

Hi Experts, I want to get my shell script output in a color for a particular word. PFB my output. TT.QM.JTV1S1 TLORSBT2.JMR701T1.C1 REPOS TT.QM.JTV1R1 TLORSBF2.JMR701T1.C1 NORMAL whenever REPOS word comes then entire line should come in red color. Can you please help me... (4 Replies)
Discussion started by: darling
4 Replies

4. Shell Programming and Scripting

Need help with shell, trying to append or separate values in a string

Ok. I for the life of me cant figure out how to do this. I need Help. So here is what I'm trying to do. I have a block of text. They are FIPS codes for counties. Below is the block. There are probably a few ways to do this. The first line starting with ARC021....... this line is a list of... (2 Replies)
Discussion started by: chagan02
2 Replies

5. Shell Programming and Scripting

Shell scripting -append a new string

hi all , i am looking for a shell script which looks into a directory of text files and searches for a string(abc123) in all the text files and if that exists add a new line(abc124) in all the *.txt files automatically, or if (abc124) exists add (abc123) can you all please help me. (6 Replies)
Discussion started by: joseph.dmello
6 Replies

6. Shell Programming and Scripting

Shell Script to append files

I have several content (text) files in a folder called "content" I have several google ads (text) files in a folder called "google_ads" Example: /content /java websphere.txt android.txt /microsoft framework.txt /c_sharp linq.txt ... (4 Replies)
Discussion started by: rac.mike
4 Replies

7. Shell Programming and Scripting

Truncate and Append in unix shell scripting

Hi All, I have a long log file (abc.log) which contains large volume of data that need to be inserted into the database as clob. I am having problem in inserting the long log file into the clob field if the cahracters in the file exceeds. So iwould like to truncate the file upto 32767... (3 Replies)
Discussion started by: rajeshorpu
3 Replies

8. Shell Programming and Scripting

shell script - insert oracle

Hi Frnds, in shell script I have one problem while inserting into oracle table . my script #! /usr/bin/sh while read record do echo $record X=`sqlplus -s STN/errrmddb20@MAHFDR <<eof insert into STN.STN_ERROR_TABLE values($record); eof`... (12 Replies)
Discussion started by: Gopal_Engg
12 Replies

9. Shell Programming and Scripting

How to insert/append line using hamilton cshell

Hi everyone I just need a script that should just search for a particular keyword in a line and after that it should add some text to the next line. I have tried it in HAMILTON CSHELL using sed "hello/a\newtext" file.txt But it give me message sed: "\" must terminate the "a"... (4 Replies)
Discussion started by: sarbjit
4 Replies

10. Shell Programming and Scripting

Insert C code in shell script

Hi, Anybody know on how to insert C code in shell script. I am writing BLOB data to a database table in C but I don't know on how to insert the C code in shell script. Thanks in advance. (1 Reply)
Discussion started by: badbunny9316
1 Replies
Login or Register to Ask a Question