How to remove everything after a word containing string?


Login or Register to Reply

 
Thread Tools Search this Thread
# 15  
Old 01-29-2019
found another interesting solution. limited the record to the number of the matching field NF=i
Code:
awk 'NR==FNR {T[$0]; next} {for(t in T) {for(i=1;i<=NF;i++) if ($i ~ t) NF=i}} 1' readfile source*

These 2 Users Gave Thanks to nezabudka For This Post:
baris35 (4 Weeks Ago) Neo (01-29-2019)
# 16  
Old 4 Weeks Ago
Hello,
I was away. Have just tested the code and works nice.
Thank you so much

Kind regards
Boris
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Please remove the word from posts ptappeta Post Here to Contact Site Administrators and Moderators 4 11-06-2015 12:01 AM
Remove string perl with first or last word is in a list cyrine Shell Programming and Scripting 2 01-10-2015 12:25 PM
Remove word before a character wahi80 Shell Programming and Scripting 2 10-13-2014 01:30 PM
Remove not only the duplicate string but also the keyword of the string in Perl askari Shell Programming and Scripting 2 03-12-2014 08:09 PM
Remove word with sed aydj Shell Programming and Scripting 5 03-11-2014 07:43 AM
Remove last word of a string? sea Shell Programming and Scripting 1 02-24-2014 10:51 AM
How to remove first word? pokhraj_d Shell Programming and Scripting 6 12-25-2013 02:14 AM
Remove 1st word and _ from string vedanta Shell Programming and Scripting 1 05-21-2013 09:16 AM
sed command to remove a word from string anand.shah Shell Programming and Scripting 7 12-11-2012 07:25 AM
want to remove last word. javeedkaleem Shell Programming and Scripting 7 09-22-2011 04:40 AM
Replace a word in a string starting with another word mukeshbaranwal Shell Programming and Scripting 2 07-26-2011 03:01 AM
grep part of word or Another word from a string linuxadmin Shell Programming and Scripting 2 05-30-2011 01:25 AM
remove characters from string based on occurrence of a string victor369 Shell Programming and Scripting 5 02-03-2011 08:37 PM
Remove particular word from file darshakraut Shell Programming and Scripting 4 09-10-2009 08:45 AM
how to remove first word malaysoul Shell Programming and Scripting 1 05-29-2008 03:33 AM