Skip to main content

tail n lines for all xvg files


During our day-to-day work, we end up all files with same extension. So, if we want to output the last few lines of similar type of files, we can follow the following approach.

for xvg in *.xvg; do echo $xvg;cat $xvg|tail -2 $xvg; done
By default,  tail outputs last 10 lines, so we cannot use:

tail *.xvg
If we want the look at the 2 lines instead of 10, we can use the above one-liners.

Comments

Popular posts from this blog

Find : Multiple files with different strings

Use find command for multiple search string? Yes, we can. find . -type f \( -name "*.xvg" -o -name "*.log" \) We must not forget to have space before -name  in both the above occurrences. Enable Ginger Cannot connect to Ginger Check your internet connection or reload the browser Disable in this text field Edit Edit in Ginger Edit in Ginger ×