Query !
what command i have to use for this query ?
List all the files which are starting from p character , and store all of these files in another dir using "pipeline" ! |
Hope this will help you
ls | grep ^p.* > /path/to/file |
@ piyush sharma .
can you please tell me , that at the same time of sending that output to some file , can we display it in our screen ! |
I didn't get any other way, When redirection is used, all the text moves to that file.
you can try this : ls | grep ^p.* > /path/to/file;cat /path/to/file |
I am asking this , because i find this query in "Sir yashwant kanitkar's" unix book , that in one line solve this query !
|
It does the same in "one line", What you say? problem is if we were to do it in "one command". because after semicolon, this (cat) is a new command.
|
isn't tee command meant for this multiple redirection (console and file)
|
Quote:
ls | grep ^p.* |tee /path/to/file |
The grep is unnecessary and can lead to false positives if there are files with a newline character in their name. Just do it this way:
Code:
ls p* | tee /path/to/file |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 10:45 AM. |