linux - Redirecting output of cat to sort -


i have following problem: names of cities should accepted keyboard. list of cities should combined list of cities present in file cityfile. combined list should sorted , sorted output should stored in file newfile. have solve using pipelining. wrote following pipelines:

cat >>  cityfile | sort > newfile  sort | cat >> cityfile >  newfile 

how can pass data of cityfile sort command ?

the cat command concatenates input. input can files or stdin. common key stdin "-". holds cat command. do:

cat - cityfile | sort > newfile 

you can find information man cat.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -