Match and replace


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Match and replace
# 8  
Old 07-26-2012
Quote:
Originally Posted by jacobs.smith
LOL!!!!!!!!!! SmilieSmilieSmilieSmilieSmilieSmilieSmilieSmilieSmilie

That was just my requirement. Thanks for your valuable time and esteemed support. Stay in touch. Take care!

---------- Post updated at 05:08 PM ---------- Previous update was at 04:31 PM ----------

Hi vgersh99,

Instead of printing one and two, the code is simply printing one for all the records between 143 and 456. Is there a way to tell it how to consider the next one if there is another record that starts with '>'.
hm.... I don't quite follow....
Do you want to print only the UNIQUE records?
Could you illustrate with the representative input files and the desired output, pls?

Last edited by vgersh99; 07-27-2012 at 11:01 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Replace characters after match

I have a file with lines like: foo find "https://localhost" "/website/foo" "this/that/the/other" "yes/no/maybe" -u admin -p admin > yes/no/maybe.txt I'd like to replace the slashes in the last column with hyphens, like this: foo find "https://localhost" "/website/foo"... (4 Replies)
Discussion started by: spacegoose
4 Replies

2. Shell Programming and Scripting

If pattern match, replace it with #

This command is not working for me. awk '{if ($1 == server) {$1 = #server} }' /etc/ntp.conf # grep server /etc/ntp.conf # Use public servers from the pool.ntp.org project. server 0.rhel.pool.ntp.org iburst server 1.rhel.pool.ntp.org iburst server 2.rhel.pool.ntp.org iburst server... (5 Replies)
Discussion started by: kenshinhimura
5 Replies

3. Shell Programming and Scripting

Partial Match and Replace

Hi, I have a tab delimited text file like this one. I need to do a partial match of a particular cell and then replace matches with an empty cell. So here is a sample: Smith FordMustang ChevroletCamaro Miller FordFiesta Jones KiaSorrento Davis ChevroletCamaro Johnson ToyotaHighlander I... (4 Replies)
Discussion started by: mikey11415
4 Replies

4. Shell Programming and Scripting

Rearrange or replace only the second line after pattern match or pattern match

Im using the command below , but thats not the output that i want. it only prints the odd and even numbers. awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}' Im hoping for something like this file1: Text hi this is just a test text1 text2 text3 text4 text5 text6 Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies

5. Shell Programming and Scripting

sed Character match and replace

Hello All I am struck in the issue which I want to share with all of you. What I am trying to do is For every line in a file I have to replace a particular character from the given character in a file For Example Suppose the data is 1111x2222 1111x2222 2222y3333 1111x2222 I... (4 Replies)
Discussion started by: adisky123
4 Replies

6. Shell Programming and Scripting

How to replace with pattern match using Perl

I have to replace a line, if it has a pattern for example Suppose file.out contains: <tr><td class="cB">Hello</td><td class="cB">1245</td><td class="cB">958</td><td class="cRB">1.34</td><td class="cRB">1.36</td></tr> <tr><td class="cB">world</td><td class="cB">3256</td><td... (8 Replies)
Discussion started by: sol_nov
8 Replies

7. Shell Programming and Scripting

Help with Pattern match and replace

I have a file containing a multiple lines of the format sddfdsf_gaf/ywrtrtwrt_gaf ghfghfgh_ert/xcvxcvcv_ert werwerwwerw_adf/jkhjkhjkjhkjhk_adf I am interested in only the first 3 letters following the "_" character and make those 3 letters uppercase after extraction. So would like to convert... (5 Replies)
Discussion started by: inditopgun
5 Replies

8. Shell Programming and Scripting

Match and replace value in 2 different places using awk

Hi, I need help on replacing values in certain field in my file1.txt based on matched patterns in file2.txt using awk. The blue color need to match with one of the data in field $2 in file2.txt. If match, BEGIN and FINISHED value in red will have a new value from field $3 and $4 accordingly.... (3 Replies)
Discussion started by: redse171
3 Replies

9. Shell Programming and Scripting

Match pattern and replace

Hi All, I am new to unix shell scripting, I need your help guys in coming up with some thing for the following scenario: file1 ABC_BASE ${base} ABC_ACC ${acc} ABC_TEST ${test} 01-01-2006 ${from_dt} 01-15-2006 ${to_dt} file 2 I have an file2.sql file which contains: ####This... (4 Replies)
Discussion started by: sol_nov
4 Replies

10. Shell Programming and Scripting

Match and replace in different files

Hi, I want to replace the content in 3rd column in the first file by the line in the 2nd file (a list) if matches with 1st column of 2nd file. There are many 1st files in different directories: File1 172.27.1.15 222 I_J_Mar_Sci_34_27.pdf 172.27.28.1 489 Sci_Cult_71_60.pdf... (3 Replies)
Discussion started by: srsahu75
3 Replies
Login or Register to Ask a Question