04-02-2011
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
If I want to have a look at few lines of the file, how do I, what command to use.
Eg: If I have a file having length 2000 lines and I want to have a look at the content between 1400 and 1600, How do I look at it ?
Also, If I want to have a look at function alone in a file, how do I go... (4 Replies)
Discussion started by: sharuvman
4 Replies
2. UNIX for Dummies Questions & Answers
This is truly dummy question.
I have a text file of 100 lines.
What unix commnad to extract line 20 to 40 and output it to another file?
Is it something cat or grep or >> ?
Thanks (6 Replies)
Discussion started by: champion
6 Replies
3. UNIX for Dummies Questions & Answers
I have a file that has 1k lines and i want to print all the lines after 900th line.
an 2)I want to move files f1 ,f2,f3,f4 to p1,p2,p3,p4
Please give me the commands.
Thanx in adv. (6 Replies)
Discussion started by: rajashekar.y
6 Replies
4. Shell Programming and Scripting
Hi,
I am sure this is possible in awk or sed or a combination of the two.
Can someone help me determine the best way to display or print certain section of a file, ie only certain number of lines.
Example: File1 1 has 20 lines.
I need to be able to print from line 5 to line 10 of this file.... (2 Replies)
Discussion started by: jerardfjay
2 Replies
5. Shell Programming and Scripting
Hi
to all in this great forum, im sure this has been asked lots of times before but ive been looking for the past day and cant find the answer.
I use cat/some/file to display its contents but how can i get it to not display hashed out lines, or do i need another command,
Thanks in advance:) (5 Replies)
Discussion started by: dave123
5 Replies
6. Shell Programming and Scripting
I have a file with a list of config files numbered on the lefthand side 1-300. I need to have bash read each lines number and assign it to a variable so it can be chosen by the user called by the script later.
Ex. 1 some data
2 something else
3 more stuff
which number do you... (1 Reply)
Discussion started by: glev2005
1 Replies
7. Shell Programming and Scripting
Hello
Wondering if anybody can advise me how I can sort the below file so it only displays lines with the latest versions of an object? As you'll see some of the scripts listed in my file have more than one version number (version number is after the file extension). E.g. cdm_bri.pkb has... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies
8. UNIX for Advanced & Expert Users
Hi all
Thanks in advance...........
Please help me for this issue............
I have a file it has 11 records . I used the command like ....
>$ wc -l file
11 file
I'm getting output like 11 file (no.of records along with filename)
here my requirement is, I want to display only... (3 Replies)
Discussion started by: ksrivani
3 Replies
9. Shell Programming and Scripting
awk 'BEGIN{IGNORECASE=1} /error|warning|exception/ { ++x } END { print x }' filename
The above command returning the number of times the pattern present in the file. But I want the the line number as well. please help me out (6 Replies)
Discussion started by: arukuku
6 Replies
10. Shell Programming and Scripting
Hi Guys,
I want to echo last 5 lines of a file to a mail. My script getting continuously looped and not getting the output. can anyone help?
#!/bin/bash
read karthick;
tail -5 $karthick;
echo $karthick | mail -s "genius" someone@gmail.com
Thanks
NK (2 Replies)
Discussion started by: Karthick N
2 Replies
TAIL(1) BSD General Commands Manual TAIL(1)
NAME
tail -- display the last part of a file
SYNOPSIS
tail [-F | -f | -r] [-q] [-b number | -c number | -n number] [file ...]
DESCRIPTION
The tail utility displays the contents of file or, by default, its standard input, to the standard output.
The display begins at a byte, line or 512-byte block location in the input. Numbers having a leading plus ('+') sign are relative to the
beginning of the input, for example, ``-c +2'' starts the display at the second byte of the input. Numbers having a leading minus ('-') sign
or no explicit sign are relative to the end of the input, for example, ``-n 2'' displays the last two lines of the input. The default start-
ing location is ``-n 10'', or the last 10 lines of the input.
The options are as follows:
-b number
The location is number 512-byte blocks.
-c number
The location is number bytes.
-f The -f option causes tail to not stop when end of file is reached, but rather to wait for additional data to be appended to the
input. The -f option is ignored if the standard input is a pipe, but not if it is a FIFO.
-F The -F option implies the -f option, but tail will also check to see if the file being followed has been renamed or rotated. The
file is closed and reopened when tail detects that the filename being read from has a new inode number. The -F option is ignored if
reading from standard input rather than a file.
-n number
The location is number lines.
-q Suppresses printing of headers when multiple files are being examined.
-r The -r option causes the input to be displayed in reverse order, by line. Additionally, this option changes the meaning of the -b,
-c and -n options. When the -r option is specified, these options specify the number of bytes, lines or 512-byte blocks to display,
instead of the bytes, lines or blocks from the beginning or end of the input from which to begin the display. The default for the -r
option is to display all of the input.
If more than a single file is specified, each file is preceded by a header consisting of the string ``==> XXX <=='' where XXX is the name of
the file unless -q flag is specified.
EXIT STATUS
The tail utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
cat(1), head(1), sed(1)
STANDARDS
The tail utility is expected to be a superset of the IEEE Std 1003.2-1992 (``POSIX.2'') specification. In particular, the -F, -b and -r
options are extensions to that standard.
The historic command line syntax of tail is supported by this implementation. The only difference between this implementation and historic
versions of tail, once the command line syntax translation has been done, is that the -b, -c and -n options modify the -r option, i.e., ``-r
-c 4'' displays the last 4 characters of the last line of the input, while the historic tail (using the historic syntax ``-4cr'') would
ignore the -c option and display the last 4 lines of the input.
HISTORY
A tail command appeared in PWB UNIX.
BSD
June 29, 2006 BSD