sed find word ending with


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed find word ending with
# 1  
Old 08-22-2007
sed find word ending with

Hi I want to use sed to find words ending in a pattern and then have it delete these words. Not sure if there is a better command to do this. I was thinking of a find and replace but I'm not sure of the syntax to look for a word ending with this pattern and not sure how to replace the whole word.
# 2  
Old 08-22-2007
Quote:
Originally Posted by eltinator
Hi I want to use sed to find words ending in a pattern and then have it delete these words. Not sure if there is a better command to do this. I was thinking of a find and replace but I'm not sure of the syntax to look for a word ending with this pattern and not sure how to replace the whole word.
Could you provide some examples please?
# 3  
Old 08-22-2007
sorry nm, got this one to work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies

2. Shell Programming and Scripting

How do i replace a word ending with "key" using awk excpet for one word?

echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} | awk 'gsub(/^|abc,|$/,"") {print}' Required output {grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies

3. UNIX for Dummies Questions & Answers

General find /grep question: files with lines ending in r

I am trying to find files that have lines in them that end in an r. I have been able to locate files by using the following command: find . -type f -name "*RECORDS"| xargs grep -l r$ However, I now want to find files that don't end in r anywhere. That means that no sentences or lines in... (9 Replies)
Discussion started by: newbie2010
9 Replies

4. Shell Programming and Scripting

perl lwp find word and print next word :)

hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this: I have in my response lines like: <div class="sender">mimi020</div> <some html code.....>... (3 Replies)
Discussion started by: vogueestylee
3 Replies

5. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

6. UNIX for Dummies Questions & Answers

How to get last word from a line ending with "/" in Unix

Hello All, I have a scenario to read a file containing text like this:(say file name is Dummy.txt) /home/abc/test1/ | file1 /home/abc/test2/ | file2 I used a variable to store the content from file like this (say for line1): File=`head -1 Dummy.txt | cut -f1 -d "|"` Dir=`head -1 Dummy.txt... (2 Replies)
Discussion started by: Quesemail
2 Replies

7. Shell Programming and Scripting

sed in script creates output file ending with '?' (^M)

Hi, I'm trying to use sed within a shell script (bash, running ubuntu). The command works fine from the command line, but when I use it within the script, rather than creating a file with the name I've specified, it creates one that ends with a question mark '?' when you use ls, e.g.... (3 Replies)
Discussion started by: jennykay
3 Replies

8. Shell Programming and Scripting

How to delete ending/trailing spaces using awk,sed,perl?

How to delete ending/trailing spaces using awk,sed,perl? Input:(each line has extra spaces at the end) 3456 565 3 7 35 878 Expected output: 3456 565 3 7 35 878 (5 Replies)
Discussion started by: cola
5 Replies

9. Shell Programming and Scripting

Word count of lines ending with certain word

Hi all, I am trying to write a command that can help me count the number of lines in the /etc/passwd file ending in bash. I have read through other threads but am yet to find one indicating how to locate a specifc word at the end of a line. I know i will need to use the wc command but when i... (8 Replies)
Discussion started by: warlock129
8 Replies

10. Shell Programming and Scripting

find a word in a file, and change a word beneath it ??

Hi all, I have a file with lines written somewhat like this. aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec (2 Replies)
Discussion started by: vikas027
2 Replies
Login or Register to Ask a Question