08-15-2014
Quote:
Originally Posted by
Don Cragun
Is this a homework assignment?
NOPE
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Greetings.
I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file.
I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
2. Shell Programming and Scripting
Hi Folks !!!!!!!!!!!!!!!!!!!
My Requirement is.............
i have a input file:
501,501.chan
502,502.anand
503,503.biji
504,504.raja
505,505.chan
506,506.anand
507,507.chan
and my o/p should be
chan->3
i.e. the word which occurs maximum number of times in a file should be... (5 Replies)
Discussion started by: aajan
5 Replies
3. UNIX for Dummies Questions & Answers
Hi I have a text file like this name today.txt
the request has been accepted
the scan is successful at following time
there are no invalid packages
5169378 : map : Permission Denied
the request has been accepted
Now what i want do is
I want to search the today.txt file and
if i... (1 Reply)
Discussion started by: gsusarla
1 Replies
4. Shell Programming and Scripting
I've been looking on the internet, and haven't found anything simple enough to use in my code. All I want to do is count how many times "-" occurs in a string of characters (as a package name). It seems it should be very simple, and shouldn't require more than one line to accomplish.
And this is... (2 Replies)
Discussion started by: Shingoshi
2 Replies
5. Shell Programming and Scripting
Hi folks,
have a look into the attachment, i am not familiar with unix, can you please help me in this regard.
thanks in advance, :)
regards,
Geeko (4 Replies)
Discussion started by: geeko
4 Replies
6. UNIX for Dummies Questions & Answers
I have a File with the below contents
File1
I have no prior experience in unix. I have just started to work in unix.
My experience in unix is 0. My Total It exp is 3 yrs.
I need to replace the first word in each line with the last word for example
unix have no prior experience in... (2 Replies)
Discussion started by: kri_swami
2 Replies
7. Shell Programming and Scripting
i have a file in this pattern
MATCH1 word1 IMAGE word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH1 word1 IMAGE word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies
8. UNIX for Dummies Questions & Answers
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies
9. Shell Programming and Scripting
Hi All,
Hope you guys had a wonderful weekend
I have a scenario where in which I have to read a file line by line
and check for few words before redirecting to a file
I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies
10. UNIX for Beginners Questions & Answers
Hi there I am trying to figure out and understand what the syntax would be to egrep lines that have a word occur twice in a row. the two words obviously should have a space between them and also it has to be case sensitive which I believe grep is by deffault. the closest I have come is...
grep... (7 Replies)
Discussion started by: spo_2138
7 Replies
wc(1) General Commands Manual wc(1)
NAME
wc - count words, lines, and bytes or characters in a file
SYNOPSIS
[file]...
DESCRIPTION
The command counts lines, words, and bytes or characters in the named files, or in the standard input if no file names are specified. It
also keeps a total count for all named files.
A word is a string of characters delimited by spaces, tabs, or newlines.
Options
recognizes the following options:
Report the number of bytes in each input file.
Report the number of newline characters in each input file.
Report the number of characters in each input file.
Report the number of words in each input file.
The and options are mutually exclusive. Otherwise, the and or options can be used in any combination to specify that a subset of lines,
words, and bytes or characters are to be reported.
When any option is specified, reports only the information requested. If no option is specified, the default output is
When a file is specified on the command line, its name is printed along with the counts.
Standard Output
By default, the standard output contains an entry for each input file in the form:
newlines words bytes file
If the option is specified, the number of characters replaces the bytes field in this format.
If any option is specified, the fields for the unspecified options are omitted.
If no file operand is specified, neither the file name nor the preceding blank character is written.
If more than one file operand is specified, an additional line is written at the end of the output, of the same format as the other lines,
except that the word (in the POSIX locale) is written instead of a file name and the total of each column is written as appropriate.
Under UNIX Standard environment, a word is a string of characters delimited by spaces, tabs, newline, carriage-return, vertical tab, or
form-feed.
RETURN VALUE
exits with one of the following values:
Successful completion.
An error occurred.
EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5).
Environment Variables
determines the range of graphics and space characters, and the interpretation of text as single- and/or multibyte characters.
determines the language in which messages are displayed.
If or is not specified in the environment or is null, they default to the value of
If is not specified or is null, it defaults to (see lang(5)).
If any internationalization variable contains an invalid setting, they all default to See environ(5).
International Code Set Support
Single- and multibyte character code sets are supported. with a newline character, the count will be off by one.
WARNINGS
The command counts the number of newlines to determine the line count. If a text file has a final line that is not terminated with a new-
line character, the count will be off by one.
EXAMPLES
Print the number of words and characters in
The following is printed when the above command is executed:
where words is the number of words and chars is the number of characters in
SEE ALSO
standards(5).
STANDARDS CONFORMANCE
wc(1)