0

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.

user3255841
  • 113
  • 1
  • 2
  • 8
  • maybe something like `if grep -q "search string" file ; then cat file ; fi` ? Good luck. – shellter May 15 '17 at 16:18
  • The `gawk` tag is visited by far fewer people far less often than the `awk` tag so to get more people looking at your question with a view to helping you, tag your awk questions with `awk`, optionally add a `gawk` tag if you like, and state in your question that you're using gawk. – Ed Morton May 18 '17 at 19:14

0 Answers0