Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17901

How to search a text file and then output the found values to a new text file

$
0
0

Hey guys!

Looking for some help... I would like to search a text file (.txt) for keywords and output the found word/number to a new text file using Terminal. Iv used grep and perl and awk in the past but can't seem to find the correct expression to pick out the correct string. Its worth noting the original text file will change weekly so I would like to put a wildcard variable in there... ideally I would search for 'awayteam=32' with '32' being the variable .... so the value 32 would be printed to the new text file if that makes sense? and next week the text file would be 'awayteam=28' and 28 could be output to the text file?

submitted by /u/iBillie
[link] [comments]

Viewing all articles
Browse latest Browse all 17901

Trending Articles