bash - Get everything in a file after a grep'd string -


yesterday situation came needed me separate out tail end of file, specified being after particular string (for sake of argument, "foo"). needed went option knew work , disregarded right way or best way, , went following:

grep -n foo file.txt | cut -f1 -d":" | xargs -i{} tail -n +{} file.txt > newfile.txt 

the thing bugged me use of xargs singleton value. thought go flex google-fu on interested see sort of things people out in so-land came situation

sed -n '/re/,$p' file 

is occurs me right off.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -