- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: question on cat <file> |wc -l output redirecti...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:53 PM
03-08-2002 12:53 PM
"cat
Thanks in advance
Narasimham
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:57 PM
03-08-2002 12:57 PM
Re: question on cat <file> |wc -l output redirection
Method 1:
COUNT=$(cat file|wc -l)
Method 2:
cat file|wc -l | read COUNT
Method 3:
COUNT=`cat file>|wc -l`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:57 PM
03-08-2002 12:57 PM
Re: question on cat <file> |wc -l output redirection
Try,
COUNT=`cat file_name|wc -l`
echo $COUNT
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 01:51 PM
03-08-2002 01:51 PM
Re: question on cat <file> |wc -l output redirection
A slight variation...
You can simplify all the above answers by using "wc -l file" instead of "cat file | wc -l".
You'll get the same results.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 05:12 PM
03-08-2002 05:12 PM
Re: question on cat <file> |wc -l output redirection
Note: The use of reverse quotes (accent grave, back tics) is deprecated these days. That's fancy Unix-speak that means outdated and not recommended. The replacement is $(...) where ... is the command(s) that are to be executed. One of the reasons for not using the back tics is the difficulty is recognizing the very different character. This is especially true in faxes and far too many fonts. Even in the ITRC forums, the proportional font used to display questions and responses makes them look similar: `` ''
Bill Hassell, sysadmin