Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

plan9-look(1) [debian man page]

LOOK(1) 						      General Commands Manual							   LOOK(1)

NAME
look - find lines in a sorted list SYNOPSIS
look [ -dfnixtc ] [ string ] [ file ] DESCRIPTION
Look consults a sorted file and prints all lines that begin with string. It uses binary search. The following options are recognized. Options dfnt affect comparisons as in sort(1). -i Interactive. There is no string argument; instead look takes lines from the standard input as strings to be looked up. -x Exact. Print only lines of the file whose key matches string exactly. -d `Directory' order: only letters, digits, tabs and blanks participate in comparisons. -f Fold. Upper case letters compare equal to lower case. -n Numeric comparison with initial string of digits, optional minus sign, and optional decimal point. -t[c] Character c terminates the sort key in the file. By default, tab terminates the key. If c is missing the entire line comprises the key. If no file is specified, /lib/words is assumed, with collating sequence df. FILES
/lib/words SOURCE
/src/cmd/look.c SEE ALSO
sort(1), grep(1) DIAGNOSTICS
The exit status is ``not found'' if no match is found, and ``no dictionary'' if file or the default dictionary cannot be opened. LOOK(1)

Check Out this Related Man Page

look(1) 						      General Commands Manual							   look(1)

NAME
look - Finds lines in a sorted list SYNOPSIS
look [-df] [-tcharacter] string [file] The look command prints all lines in a sorted file that begin with string. OPTIONS
Uses dictionary order; only letters, digits, tabs, and spaces are used in comparisons. Searches without regard to case; treats uppercase and lowercase as equivalent. Ignores character and characters following it in the search string. If you specify look -tC ABCDE, the string ABCDE would become (in effect) AB, with CDE being ignored. This option is primarily for shell scripts, in which more than one string is being processed. DESCRIPTION
If no file is specified, look searches in the system word list /usr/share/dict/words, with the options -df assumed by default. The look command uses binary search. The -d and -f options affect comparisons as in sort. NOTES
In order to use the -f option, you must first sort file with the sort -f command; otherwise, look displays only lowercase items. If you do not specify -f, but specify a file (such as /usr/share/dict/words) that has been sorted with sort -f, look may not produce any output. EXAMPLES
To search a sorted file called sortfile for all lines that begin with the string as, enter: look as sortfile To search the system word list for all words beginning with smi, enter: look smi This might result in: smile smirk smith smithereens Smithfield Smithson smithy smitten FILES
System word list. SEE ALSO
Commands: grep(1), sort(1), spell(1) look(1)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep two lines at a time

Hello; i have a log file which had Invalid, error, missing words in it. I want to grab a line which matches either of the above words and one more line below the grepped line. Can this be done? I looked on other places on your forum, but there is nothing which is working. I tried... (6 Replies)
Discussion started by: joshjimda
6 Replies

2. Shell Programming and Scripting

finding lines only between a certain string

Dear experts, Ive been trying to figure this out for a while, but i cant. Please help. I have a file, with approx 1 million lines. The contents are separated with "----------". Please see example below So my problem is, i need to find all texts that have the keyword "GAA", but i need... (14 Replies)
Discussion started by: aismann
14 Replies

3. Shell Programming and Scripting

Grepping for Exact Strings

ok, apparently this is a very difficult question to answer based on my searches on google that came up fruitless. what i want to do is grep through a file for words that match a specified string. but the thing is, i keep getting all words in the file that have the string in them. say for... (27 Replies)
Discussion started by: SkySmart
27 Replies

4. Shell Programming and Scripting

sort words in a line

Hi Im looking for a way, hopefully a one-liner to sort words in a line e.g "these are the words in a line" to "a are in line the these words" Thanks! (15 Replies)
Discussion started by: rebelbuttmunch
15 Replies

5. Emergency UNIX and Linux Support

Getting last 50 lines after finding a word

Hi All, I have a requirement as below I need find for a string in a log file and once i found that string i need to send a mail.Thsi can be done thru grep and mailx cmnd. Here once i found the string i need to send last 50 lines(up) from where string found. Actually they require to find... (9 Replies)
Discussion started by: pssandeep
9 Replies

6. Shell Programming and Scripting

Finding the number of unique words in a file

find the number of unique words in a file using sort com- mand. (7 Replies)
Discussion started by: abhikamune
7 Replies

7. Shell Programming and Scripting

awk: sort lines by count of a character or string in a line

I want to sort lines by how many times a string occurs in each line (the most times first). I know how to do this in two passes (add a count field in the first pass then sort on it in the second pass). However, can it be done more optimally with a single AWK command? My AWK has improved... (11 Replies)
Discussion started by: Michael Stora
11 Replies

8. Shell Programming and Scripting

Script to compare 2 words (first and last letter only)

Hello, I need a script to do the following: I have a file filled of lines like: valu -> value confirmaton -> confirmation I need a script to compare the first and last letters of the words, for example for the line: valu -> value compare "v" to "v" and "u" to "e" and print the line... (7 Replies)
Discussion started by: bojomojo
7 Replies

9. Shell Programming and Scripting

Grep a string and write a value to next line of found string

Hi, I have two variables x and y. i need to find a particular string in a file, a workflow name and then insert the values of x and y into the next lines of the workflow name. basically it is like as below wf_xxxxxx $$a= $$b= $$c= figo $$d=bentley i need to grep the 'wf_xxxx' and then... (6 Replies)
Discussion started by: angel12345
6 Replies

10. UNIX for Dummies Questions & Answers

Extract lines with specific words with addition 2 lines before and after

Dear all, Greetings. I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed. For example, the input file is: 1 ak1 abc1.0 1 ak2 abc1.0 1 ak3 abc1.0 1 ak4 abc1.0 1 ak5 abc1.1 1 ak6 abc1.1 1 ak7... (7 Replies)
Discussion started by: Amanda Low
7 Replies

11. Shell Programming and Scripting

How can I sort by n number is like words?

I want to sort a file with a list of words, in order of most occuring words to least occurring words as well as alphabetically. ex: file1: cat 3 cat 7 cat 1 dog 3 dog 5 dog 9 dog 1 ape 4 ape 2 I want the outcome to be: file1.sorted: dog 1 (12 Replies)
Discussion started by: castrojc
12 Replies

12. UNIX for Dummies Questions & Answers

Help with if then sentence (string in file)

Hello! I'd like some help with a sentance, this 'if' should take a string from the user, then search my list for that string, now only those lines that string is found should be worked on. I'm new to this, but i'm guessing it's something like this.. #!/bin/bash ... (10 Replies)
Discussion started by: klskl
10 Replies

13. UNIX for Dummies Questions & Answers

Sort concept confusion

By default, sort reorders lines in ASCII collating sequence --- whitespace first, then numerals,uppercase letters and finally lowercase letters. Shellscript:cat sort.txt aaa bbb ddd AAA eee GGG ggg Shellscript:sort sort.txt aaa AAA bbb ddd eee ggg GGG Why the default output... (6 Replies)
Discussion started by: shellscripting
6 Replies

14. UNIX for Dummies Questions & Answers

awk - Print lines if only matching key is found

I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. Thanks a lot. Any help is appreciated. Script I am using: awk 'FNR == NR && ! /^]*$/ {... (9 Replies)
Discussion started by: High-T
9 Replies

15. Shell Programming and Scripting

How do i sort lines lexigraphical in bash?

I am currently having some problems with my script not sorting my files lexiographically. The error seem to be localized here where i sort the utt2spk file, which is done like this.. for x in test train; do for f in text utt2spk; do sort data/$x/$f -o... (7 Replies)
Discussion started by: kidi
7 Replies