Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Create the equivalent of the command WC Post 302843486 by MadeInGermany on Tuesday 13th of August 2013 01:17:14 PM
Old 08-13-2013
Quote:
Originally Posted by rbatte1
What's wrong with wc anyway? Smilie

I suppose you could also use:-
Code:
grep -c "" file

...amongst other things, but wc is written for the purpose. Smilie

Robin
Certain grep versions give RE error.
Code:
grep -c "^"

is a complete RE Smilie

---------- Post updated at 12:17 PM ---------- Previous update was at 12:08 PM ----------

The following emulates a wc without arguments:
Code:
awk '{c+=(length+1); w+=NF} END {printf " %-6s %-6s %s%s\n",NR,w+0,c+0,(FILENAME=="-")?"":" "FILENAME}'


Last edited by MadeInGermany; 08-13-2013 at 02:26 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Hw to create root-equivalent accounts?

Hi all. After installing ssh on a server, i'd like to create a user with root privileges. My problem is that after creating a user rootssh (uid=0, gid=20, /home/rootshh), i make rootssh's ssh keys. The problem is that normally the ssh-keygen should create the keys under $HOME/.ssh/, and actually... (6 Replies)
Discussion started by: penguin-friend
6 Replies

2. Solaris

Solaris equivalent of the ioscan command

What is the Solaris equivalent of the HP-UX "ioscan -funC" command which lists all hardware on the system? (5 Replies)
Discussion started by: etc
5 Replies

3. Shell Programming and Scripting

Equivalent command to 'stat'

Can anyone tell me which is the equivalent command to 'stats' in ksh shell which discribes the file system? Thanks in advance Regards, Im_new (6 Replies)
Discussion started by: im_new
6 Replies

4. UNIX for Advanced & Expert Users

Need svcs equivalent command

Hi, I am new to HP-UX. Can someboby help me with the svcs equivalent command in HP-UX ??? svcs is command that we use in Solaris for service status. I need to get the status of services in HP-UX. Thanks in advance. (2 Replies)
Discussion started by: EmbedUX
2 Replies

5. AIX

smitty equivalent command line command

i know after you do something in smitty via the gui, you can click something in smitty that will show you how to do the same thing via the command line, (not using the gui) can anyone tell me how (2 Replies)
Discussion started by: asyed123
2 Replies

6. UNIX for Dummies Questions & Answers

pfiles command equivalent in Linux

May i know what is the equivalent tool in linux for pflies in solaris. ? (2 Replies)
Discussion started by: mohtashims
2 Replies

7. Shell Programming and Scripting

Create a .sh file for an equivalent Excel VBA code

Hi guys, I am new to Unix, Need your help here. I have installed cygwin software (Unix) in my computer (Windows vista). Now i want to create a shell script (.sh file)/other script which is equivalent of VBA code (at the bottom) and then put this .sh file into bin directory of c:/cygwin. so... (7 Replies)
Discussion started by: bansalpankaj88
7 Replies

8. UNIX for Dummies Questions & Answers

A faster equivalent for this sed command

Hello guys, I'm cleaning out big XML files (we're talking about 1GB at least), most of them contain words written in a non-latin alphabet. The command I'm using is so slow it's not even funny: cat $1 | sed -e :a -e 's/&lt;*&gt;//g;/&lt;/N;//ba;s/</ /g;s/>/... (4 Replies)
Discussion started by: bobylapointe
4 Replies

9. Windows & DOS: Issues & Discussions

DOS Equivalent of UNIX Command

Hi, The title of this post is a little vague but I couldn't think of what to call it. In Unix you can perform the following command ftp -v IPADDRESS <<END put FILE END In a DOS command prompt, is it possible to do the same kind of thing that the "<<END" does? So for example, ... (4 Replies)
Discussion started by: Ste_Moore01
4 Replies

10. SCO

What is the equivalent command of sysadmsh in UNIXware7.1.3?

Sir I have read the book SCO Unix System Administrators Guide and I have found the command sysadmsh useful for system administration. I have tried the above command in unixware7.1.3 and I got the message command not found. Currently I am running unixware7.1.3 in VmWare WorkStsation10.0. ... (1 Reply)
Discussion started by: rupeshforu3
1 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy