Q. I have a requirement to move all my shell script meta data such as interpreter, Author, date, purpose etc which occupies my first 5 lines.
With head
head -n5 *.sh > file.txt
With SED
sed -n ‘1,4 p’ xyz.txt
or
sed ‘5,$ d’ xyz.txt
you can keep this one in for loop and execute sed command get your file content to other file.
The following two tabs change content below.

Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018