Advertisements
(How) to delete all empty lines from a file:
cat someFile | grep -v '^$'
(How) to get all numbers that have no sign in front of them (all positive numbers, from a file where on each line there is one number only):
cat someFile | grep ^[0-9]
(How) to extract all negative numbers (from a file where on each line there is one number only):
You can of course replace the minus ‘-‘ character with any other you want to use as a starting character for a line.
cat someFile | grep ^-