Tag Info

Hot answers tagged

3

GNU grep; cat: { grep -m1 'pattern' && cat || ! cat ./infile } <./infile POSIX sed; cat: { sed -ne'/PATTERN/q;H;1h;$!d;x;p'; cat; } <infile GNU sed; cat: { sed -une'/PATTERN/q;H;1h;$!d;x;p'; cat; } <infile (just add -u) sharing is nice All of the above commands work because the file-descriptor from which they read() is ...



Only top voted, non community-wiki answers of a minimum length are eligible