user3255841
user3255841

Reputation: 113

GREP/GAWK If .txt file contains string copy file

okay so i know of grep -rhi, which extrats the line if string is found, but I want to copy the entire file so for example,

file.txt >

 isexample #new
 iesameplxpele
 ieamama #new

now if I used grep -rhi "#new", it would extract only

isexample #new
ieamama #new

where as I want all the contents within the file including

iesameplxpele

How would I do this?

Of course the .txt file must contain #new in either one of its lines.

Upvotes: 0

Views: 59

Answers (0)

Related Questions