Sponsored Content
Full Discussion: awk basic issue
Top Forums Shell Programming and Scripting awk basic issue Post 302263099 by research3 on Sunday 30th of November 2008 05:33:42 PM
Old 11-30-2008
yes, but the standard output is a line and not a single word.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Basic awk question...getting awk to act on $1 of the command itself

I have a script problem that I am not able to solve due my very limited understanding of unix/awk. This is the contents of test.sh awk '{print $1}' From the prompt if I enter: ./test.sh Hello World I would expect to see "Hello" but all I get is a blank line. Only then if I enter "Hello... (2 Replies)
Discussion started by: JasonHamm
2 Replies

2. Shell Programming and Scripting

cron job issue..i hav read the basic threads already...

hi friends well m facing a different sort of issue in my cron. i hav set job like this 30 09 * * 1 /bin/backup14M 01 14 * * 1 /bin/backup14N 20 18 * * 1 /bin/backup14E that is for every Monday at three different times. but, first job executes well, later ones do not. I checked my... (13 Replies)
Discussion started by: oracle.test2
13 Replies

3. Shell Programming and Scripting

basic awk questions

I find an script with awk sitting around. I went through some online manuals, but I can't figure out exactly how it works. I can't post the whole program. Not allowed. This is the line that is confusing me. I get when else is in the script grep -v "^REM " $1| grep -v "JUNK;" | awk -F" "... (2 Replies)
Discussion started by: guessingo
2 Replies

4. Shell Programming and Scripting

Issue with basic Awk script

Here's a basic awk program I am trying to run. It shows no error but shows no result either too. If someone can look up and tell me what's wrong I will be obliged. Thanks. :) Code Snippet. #!/bin/bash awk '{ for (i = 1 ; i <= 3 ; i++) for ( j = 1 ; j <= 3 ; j++ ) { ... (2 Replies)
Discussion started by: mr.amitkc
2 Replies

5. UNIX for Dummies Questions & Answers

Basic awk help

Im sure this is an easy question, but Ive tried and tried to get this to print all on one line and cant figure out why its not, so maybe someone can help awk '/AP/{sub(/:80/, "", $4);printf $4"\t"} /User-Agent/{sub(/^*:/,"");print};sub(/\.80/,"", $4);/Host/{sub(/^*:/,""); print}' What this... (10 Replies)
Discussion started by: sectech
10 Replies

6. UNIX for Dummies Questions & Answers

Basic awk...newbie quetion

Hi, I was trying to change the value of the 4th column (put '1' in the 4th column of each row). My awk command is: awk -F, '{$3=1;}1' OFS= input.txt > ./test_out.txt My input file is: a 1 2 31 b 4 5 61 c 7 8 91 My output file (test_out.txt)is: a 1 2 31 b 4 5 61 c 7 8 91 What... (4 Replies)
Discussion started by: pc2001
4 Replies

7. UNIX for Dummies Questions & Answers

Basic arithmetic operation with awk?

input: Name|Operation rec_10|1+2+2- Output: rec_10|1 Basically I am trying to calculate the result of "the path" in $3 where the operators follow the number and not preceding them like we normally do: rec_10: +1+2-2=1 But I realise (I am sure there is a good reason for that) that awk... (7 Replies)
Discussion started by: beca123456
7 Replies

8. Shell Programming and Scripting

Confusing of some basic awk

1. increase file space first, double space a file: awk '1;{print ""}' I probably can understand it:print a blank line every time.But when I read triple space a file I am confused: awk '1;{print "\n"}' doesn't it meaning print a blank line every time too? 2. number each line of file, but... (6 Replies)
Discussion started by: hhdzhu
6 Replies
WC(1)							    BSD General Commands Manual 						     WC(1)

NAME
wc -- word, line, character, and byte count SYNOPSIS
wc [-clmw] [file ...] DESCRIPTION
The wc utility displays the number of lines, words, and bytes contained in each input file, or standard input (if no file is specified) to the standard output. A line is defined as a string of characters delimited by a <newline> character. Characters beyond the final <newline> character will not be included in the line count. A word is defined as a string of characters delimited by white space characters. White space characters are the set of characters for which the iswspace(3) function returns true. If more than one input file is specified, a line of cumulative counts for all the files is displayed on a separate line after the output for the last file. The following options are available: -c The number of bytes in each input file is written to the standard output. This will cancel out any prior usage of the -m option. -l The number of lines in each input file is written to the standard output. -m The number of characters in each input file is written to the standard output. If the current locale does not support multibyte characters, this is equivalent to the -c option. This will cancel out any prior usage of the -c option. -w The number of words in each input file is written to the standard output. When an option is specified, wc only reports the information requested by that option. The order of output always takes the form of line, word, byte, and file name. The default action is equivalent to specifying the -c, -l and -w options. If no files are specified, the standard input is used and no file name is displayed. The prompt will accept input until receiving EOF, or [^D] in most environments. ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of wc as described in environ(7). EXIT STATUS
The wc utility exits 0 on success, and >0 if an error occurs. EXAMPLES
Count the number of characters, words and lines in each of the files report1 and report2 as well as the totals for both: wc -mlw report1 report2 COMPATIBILITY
Historically, the wc utility was documented to define a word as a ``maximal string of characters delimited by <space>, <tab> or <newline> characters''. The implementation, however, did not handle non-printing characters correctly so that `` ^D^E '' counted as 6 spaces, while ``foo^D^Ebar'' counted as 8 characters. 4BSD systems after 4.3BSD modified the implementation to be consistent with the documentation. This implementation defines a ``word'' in terms of the iswspace(3) function, as required by IEEE Std 1003.2 (``POSIX.2''). SEE ALSO
iswspace(3) STANDARDS
The wc utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A wc command appeared in Version 1 AT&T UNIX. BSD
February 23, 2005 BSD
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy