unix - bash: how to redirect the result in to another file -


now have code, can show result on terminal

 cat temp | sort -n | uniq -c | awk '{ print $2, $1 }' 

but how can redirect file?

i tried echo temp | sort -n | uniq -c | awk '{ print $2, $1 }' > temp2, not working

thanks

echo temp | sort -n | uniq -c | awk '{ print $2, $1 }' > temp2 

you used echo:

cat temp | sort -n | uniq -c | awk '{ print $2, $1 }' > temp2 

also don't need use cat:

sort -n temp | uniq -c | awk '{ print $2, $1 }' > temp2 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -