Sponsored Content
Top Forums UNIX for Dummies Questions & Answers display a portion of lines from file Post 83871 by reborg on Tuesday 20th of September 2005 11:11:01 AM
Old 09-20-2005
Quote:
Originally Posted by matrixmadhan
just another way of doing it

awk '{if (NR >= 20 && NR <= 40) print $0}' inputfile > outputfile
or more concisely
Code:
awk 'NR >= 20 && NR <= 40' infile > outfile

or more quickly on a large file:
Code:
awk 'NR >= 20; NR == 40 {exit}' infile > outfile


Last edited by reborg; 09-20-2005 at 12:12 PM.. Reason: fix the tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

display few lines of the file

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. Shell Programming and Scripting

Display lines of the file on a log

Hi, I am using the Korn shell script to display lines of the file. For example below: outputfile=test.dat -- display each line of the test.dat file abcd 345 adek 45566 dve3 34565 so on... I appreciate your time to find a command for displaying lines of the file on the log. ... (2 Replies)
Discussion started by: sbryant
2 Replies

3. Shell Programming and Scripting

Display file without # lines

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

4. Shell Programming and Scripting

grep and display lines from a file

I have to grep on a few words in a file and then display the line containing those words and the line above it. For ex - File1.txt contains... abc xyz abc This is a test Test successful abc xyz abc Just a test Test successful I find the words 'Test successful' in the file... (6 Replies)
Discussion started by: user7617
6 Replies

5. Shell Programming and Scripting

Parse a file to display lines containing a word

Hi! I'm trying to create a shell script to parse a file which might have multiple lines matching a pattern (i.e. containing some word). I need to return all lines matching the pattern, but stripping the contents of that line until the pattern is matched For example, if my input file was ... (4 Replies)
Discussion started by: orno
4 Replies

6. UNIX for Dummies Questions & Answers

Display only the first two characters of all the lines from a file.

how do i Display only the first two characters of all the lines from a file.? (1 Reply)
Discussion started by: ritusubash
1 Replies

7. UNIX Desktop Questions & Answers

How to display only the lines from a file which do not contain a given number

a. How do I display the content of the file containing what Ive merged using a filter which would display only the lines of the file which don't contain number, for example 3 or 6. (3 Replies)
Discussion started by: herberwz
3 Replies

8. Shell Programming and Scripting

To display last 5 lines of a file

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

9. Shell Programming and Scripting

Shell to display portion of a line

Thanks a lot for the code and the explanation. Now my final requirement. I have uploaded 3 files as attachment. Please open the files in Editplus or any other text editor which keeps the formatting. GMDCOM.27936.log.txt------I want to pick only Process request from this file.(Please check... (9 Replies)
Discussion started by: ghosh_tanmoy
9 Replies

10. Shell Programming and Scripting

Display lines for a particular year in a file using grep

hi, I have a log file with data for more than 3 years, i want only the rows for the year 2017, say for example. My file has the data like this 08-OCT-2015 11:17:35 AAA, BBBB 08-OCT-2017 11:17:35 AAA,Bdfdfd,dfdfd,dfd 08-Nov-2017 11:17:35 AAA,Bdfdfd,dfdfd,deree i want the rows... (2 Replies)
Discussion started by: skoshekay
2 Replies
MAKE_SOCKSFC(8) 					      System Manager's Manual						   MAKE_SOCKSFC(8)

NAME
make_socksfc - Generates frozen configuratyion file for SOCKS clients SYNOPSIS
make_socksfc [infile [outfile] ] DESCRIPTION
make_socksfc reads in a plain-text configuration file for the SOCKS clients and produces a frozen configuration file as the output. Both arguments are optional. The default for infile is /etc/socks.conf; the default for outfile is /etc/socks.fc. You may specify infile while omitting outfile, but you cannot specify outfile without also speficying infile. The contents of the frozen configuration file is essentially the memory image of the parsed input file. Using the frozen configuration file can reduce the start-up delay of the SOCKS client programs since they no longer have to parse the file contents. When the SOCKS client starts, it always looks for the frozen configuration file /etc/socks.fc first . If that file is not found, it then tries to use the plain-text configuration file /etc/socks.conf. If you use frozen configuration, you must remember to run make_socksfc every time after you modify the plain-text file or the SOCKS clients will continue to use the frozen file of a previous configuration. To find out the contents of a frozen configuration file, use dump_socksfc. FILES
/etc/socks.fc, /etc/socks.conf SEE ALSO
dump_socksfc(8), socks.conf(5), socks.fc(5) AUTHOR
Ying-Da Lee, yingda@esd.sgi.com or yingda@best.com May 6, 1996 MAKE_SOCKSFC(8)
All times are GMT -4. The time now is 12:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy