sed for adding word


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed for adding word
# 1  
Old 07-09-2008
sed for adding word

hello

i have a file (myfile) contains line as follows

/home/mytarget/myproject

i want to add a pattern at the end of this line.
my pattern is- /.*mk
i want like it - /home/mytarget/myproject/*.mk

i tried sed like
sed 's/$//*.mk/' myfile > newfilename, but not wrking.
pls help
shailesh
# 2  
Old 07-09-2008
Try
Code:
sed 's!$!\/\*\.mk!'

You got to escape special characters. Exclamation mark instead of slashes for easier reading.
# 3  
Old 07-09-2008
sed

it works. thanks
BR
shailesh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Adding word in blank space

Hi, var=QSB SBD SDN SGJ SJP SKB SKD SLP SML SNB SRE SRG STP TAJ UMP UNO VKS VND VNS WAH ZRR I have to put *.sql after every word What I did echo $var>/root/file1.sql sed -i 's/ /*.sql /g' file1.sql cat file1.sql Output QSB*.sql SBD*.sql SDN*.sql SGJ*.sql SJP*.sql SKB*.sql... (9 Replies)
Discussion started by: kaushik02018
9 Replies

2. Shell Programming and Scripting

Replacing a particular word with another word in all the xml's under a particular directory with sed

Hi Folks, Could you please advise what will be the SED command to replace a word in all xml's under a particular directory for example let say I rite now at the following below location $ cd /ter/rap/config now under config directory there will be lots of xml file , now my objective is to... (1 Reply)
Discussion started by: punpun66
1 Replies

3. Shell Programming and Scripting

adding text before and after a word

Hello, I have a list: i.e: 40331786 50331787 30331788 30331789 30331790 50331791 50331792 50331793 70331794 70331795 70331796 ... ... and I need to add text before and after each number: (2 Replies)
Discussion started by: drbiloukos
2 Replies

4. Shell Programming and Scripting

Adding extra word from file1 to file2

I need to add a word from file1 to file2 accordinggly... file1 contains name of servers and file2 version of server I need that information in a single file so that the format is server_name : version I been trying but havent been able to figure out how to search for a file using sed... ... (14 Replies)
Discussion started by: eponcedeleonc
14 Replies

5. Shell Programming and Scripting

Adding Characters to a Word List

If I had a word list with a large amount of words in it, how would I (using a unix command) add, say, 123 to the end of each word? EDIT: The word list is stored in a large text file. I need a command that applies the ending to each word in the file and saves the result in a new text file. (7 Replies)
Discussion started by: evillion
7 Replies

6. Shell Programming and Scripting

Help adding a key word search to my script

Hello: I need help adding a key word search to my bash script. I have the following script. My boss whats the user to be able to add a search word e.g. unknown failures for the script to search the logs through and find the instances. I had originally done it so it grepped for unknown... (8 Replies)
Discussion started by: taekwondo
8 Replies

7. Shell Programming and Scripting

Adding a word into a file.

Dear friends, I am facing a problem with a flat file, to solve that file i need to add certain character in the file which I am not able to do because of "$" sign in the pattern. Situation is as follows. Flat file has word RMM$CART I want to reple this word by RMM$CART DFD The dollar "$"... (5 Replies)
Discussion started by: anushree.a
5 Replies

8. Shell Programming and Scripting

adding single word to multiple line.

I have following problem. <File A> contains let say 5 lines but can be changed. cat dog fish car if I want to add word to each line then how do I go about it? I used paste -d but that requires two files having same number of lines but in my case <File A> changes and I just need to... (6 Replies)
Discussion started by: paulds
6 Replies

9. Shell Programming and Scripting

Adding a word in front of a word of each line.

Adding a word in front of a word of each line.In that line only one word will be there. pl help:( (4 Replies)
Discussion started by: Ramesh Vellanki
4 Replies

10. Shell Programming and Scripting

adding text to the end of lines containing a word

I'm new to shell scripting, and need to add a series of commands to the ends of certain lines of text that contain a keyword. Any easy way to do this? Thanks (2 Replies)
Discussion started by: ironwall
2 Replies
Login or Register to Ask a Question