(head -n 2 <file> && tail -n +3 <file> | sort) > newfile
The parentheses create a subshell, wrapping up the stdout so you can pipe it or redirect it as if it had come from a single command.
More Related Contents:
- Use grep –exclude/–include syntax to not grep through certain files
- Unix command to prepend text to a file
- What is the general syntax of a Unix shell command?
- Unix sort of version numbers
- How can I pretty-print JSON in a shell script?
- What do ‘real’, ‘user’ and ‘sys’ mean in the output of time(1)?
- What are file descriptors, explained in simple terms?
- Identifying and removing null characters in UNIX
- How do I remove the passphrase for the SSH key without having to create a new key?
- Why do shell script comparisons often use x$VAR = xyes?
- How to pretty print XML from the command line?
- Why are ports below 1024 privileged? [closed]
- Executing JavaScript without a browser?
- Equivalent of *Nix ‘which’ command in PowerShell?
- How to grep for the whole word
- How do I manipulate $PATH elements in shell scripts?
- What should we do to prepare for 2038?
- Need to link cmake project to dl library
- Why do programs in Unix-like environments have numbers after their name? [duplicate]
- How to get a unix script to run every 15 seconds?
- How can I send an email through the UNIX mailx command?
- Convert decimal to hexadecimal in UNIX shell script
- Command-line Unix ASCII-based charting / plotting tool
- Setting environment variable in shell script does not make it visible to the shell
- What generates the “text file busy” message in Unix?
- How to remove EXIF data without recompressing the JPEG?
- grep a tab in UNIX
- grep for special characters in Unix
- Unix find: multiple file types
- Differences between System V and Posix semaphores