03-15-2012
It's an easy way to make each individual word its own line. Then you just hunt for the longest line.
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. UNIX for Advanced & Expert Users
i want the longest word from the file using sed.
can any one help me in this case? (6 Replies)
Discussion started by: lakshmananindia
6 Replies
3. Shell Programming and Scripting
Hi all,
I have a file with lines written somewhat like this.
aaaa
ccc
aa
linux
browse = no
xssxw
cdcedc
dcsdcd
csdw
police
dwed
dwd
browse = no
cdecec (2 Replies)
Discussion started by: vikas027
2 Replies
4. Shell Programming and Scripting
File having data in following format :
file name : file.txt
--------------------
111111;name1
222222;name2
333333;name3
I want to read this file so that I can split these into two paramaters i.e. 111111 & name1 into two different variables(say value1 & value2).
i.e val1=11111 &... (2 Replies)
Discussion started by: sjoshi98
2 Replies
5. Shell Programming and Scripting
Hi,
I want to replace a word in a file which occurs after a particular word.
For example :
$cat file.txt
CASE
WHEN
AND c1 = 'I'
AND c2= '2'
THEN 1
WHEN
AND c1= 'I'
AND c2= '0'
THEN 2
So in this example i want to replace... (4 Replies)
Discussion started by: ashwin3086
4 Replies
6. UNIX for Dummies Questions & Answers
Hi Guys,
I was going some trial and error to see if I can find the longest word in a text.
I was using Pipes because they are easier to use in this case.
I was stuck on this for a while so I thought I'll get some help with it.
I tried this code to separate all the words in a text in... (4 Replies)
Discussion started by: bawse.c
4 Replies
7. 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
8. 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
9. Shell Programming and Scripting
Hi,
I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file.
Ex:
$ cat "sample.log"
I am searching for a word which is present in this file
We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies
10. UNIX for Beginners Questions & Answers
I am trying to figure out to find word count of each word from my file
sample file
hi how are you
hi are you ok
sample out put
hi 1
how 1
are 1
you 1
hi 1
are 1
you 1
ok 1
wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies
Commands Reference, Volume 1, a - c
apropos_Command
Purpose
Locates commands by keyword lookup.
Syntax
apropos [ -M PathName ] Keyword ...
Description
The apropos command shows the manual sections that contain any
of the
keywords specified by the Keyword parameter in their title.
The apropos
command considers each word separately and does not take into
account if a
letter is in uppercase or lowercase. Words that are part of
other words
are also displayed. For example, when looking for the word
compile, the
apropos command also finds all instances of the word compiler.
The
database containing the keywords is /usr/share/man/whatis,
which must
first be generated with the catman -w command.
If the output of the apropos command begins with a name and
section
number, you can enter man Section Title. For example, if the
output of the
apropos command is printf(3), you can enter man 3 printf to
obtain the
manual page on the printf subroutine.
The apropos command is equivalent to using the man command
with the -k
option.
Note: When the /usr/share/man/whatis database is built from
the HTML
library using the catman -w command, section 3 is equivalent
to section
2 or 3. See the man command for further explanation of sec-
tions.
Flag
Specifies an alternative search path. The search
path is
-M PathName specified by the PathName parameter, and is a
colon-separated
list of directories.
Examples
1. To find the manual sections that contain the word password
in their
titles, enter:
apropos password
2. To find the manual sections that contain the word editor
in their
titles, enter:
apropos editor
File
/usr/share/man/whatis Contains the whatis data-
base.
Related Information
The catman command, man command, whatis command.
________________________________________________________________________________
Commands Reference, Volume 1, a - c
apropos_Command
Purpose
Locates commands by keyword lookup.
Syntax
apropos [ -M PathName ] Keyword ...
Description
The apropos command shows the manual sections that contain any
of the
keywords specified by the Keyword parameter in their title.
The apropos
command considers each word separately and does not take into
account if a
letter is in uppercase or lowercase. Words that are part of
other words
are also displayed. For example, when looking for the word
compile, the
apropos command also finds all instances of the word compiler.
The
database containing the keywords is /usr/share/man/whatis,
which must
first be generated with the catman -w command.
If the output of the apropos command begins with a name and
section
number, you can enter man Section Title. For example, if the
output of the
apropos command is printf(3), you can enter man 3 printf to
obtain the
manual page on the printf subroutine.
The apropos command is equivalent to using the man command
with the -k
option.
Note: When the /usr/share/man/whatis database is built from
the HTML
library using the catman -w command, section 3 is equivalent
to section
2 or 3. See the man command for further explanation of sec-
tions.
Flag
Specifies an alternative search path. The search
path is
-M PathName specified by the PathName parameter, and is a
colon-separated
list of directories.
Examples
1. To find the manual sections that contain the word password
in their
titles, enter:
apropos password
2. To find the manual sections that contain the word editor
in their
titles, enter:
apropos editor
File
/usr/share/man/whatis Contains the whatis data-
base.
Related Information
The catman command, man command, whatis command.