CyberNewbie
CyberNewbie

Reputation: 61

How to execute multiple commands within the same input

Cyber newbie. This has me completely stumped. I need to search a file called ‘countries’ for all countries containing the letter ‘y’. Following this, sort the output of this command in reverse order and write the output to a file called ‘output’. How do I sort by a particular character?

Thanks

Upvotes: 0

Views: 214

Answers (1)

user unknown
user unknown

Reputation: 36229

grep y countries | sort -r > output

should do it.

The pipe character | sends the output of the command on the left, grep, as input to the right, sort.

The output redirection character > sends the output of the result to a file 'output'.

Upvotes: 3

Related Questions