|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
output of wc
Hi All, Can any one tell me the reason of following output . Code:
$ wc -l < file1 file5 3 file5 $ wc -l < file5 file1 8 file1 My intention was to count lines of file1 and file5. But seems wc is counting lines of only one file. How can i count lines of respective files with their file name ? content of file1 and file5 are Code:
$ cat file1 emp employee empty1 empty2 empty3 empty4 empty5 errorfile $ cat file5 a is nice. i live in london. london is nice city. $ Thanks in advance... Last edited by vbe; 02-05-2012 at 03:33 AM.. |
| Sponsored Links | |
|
|
|
#2
|
|||
|
|||
|
Don't redirect ( do not use the < symbol) Code:
wc -l file1 file2 |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Thanks Jim for your response.
But my intention is to see behavior of < operator. As for as i know < should provide file1 and file2 as input to wc -l But in this case wc -l < file1 file2 only one file file1 is going as input to wc -l |
|
#4
|
||||
|
||||
|
Input redirection works on only one file, see here: Shell Command Language To use both files as standard input, you would need to concatenate: Code:
cat file1 file2 | wc -l Last edited by Scrutinizer; 02-05-2012 at 04:29 AM.. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
thanks I got it.
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk: round output or delimit output of arithmatic string | jelloir | Shell Programming and Scripting | 1 | 06-18-2010 03:07 AM |
| Converting line output to column based output | npatwardhan | Shell Programming and Scripting | 8 | 03-24-2010 08:40 AM |
| top output for six processes with the same name, output changed from column to row | Bloke | Shell Programming and Scripting | 5 | 06-04-2009 06:02 AM |
| Expect - Interact output hangs when large output | natedog | Shell Programming and Scripting | 0 | 08-27-2008 11:21 AM |
| how to make a line BLINKING in output and also how to increase font size in output | mail2sant | Shell Programming and Scripting | 3 | 04-14-2008 07:30 AM |
|
|