Sponsored Content
Full Discussion: see a specific line in file
Top Forums UNIX for Dummies Questions & Answers see a specific line in file Post 302143048 by radoulov on Tuesday 30th of October 2007 06:48:59 AM
Old 10-30-2007
For large files:

Code:
awk 'FNR == 5 { print; exit }' filename

Code:
sed '5q;d' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reading specific line from file

Hi all... I not a expert unix script programmer, Kindly adjust. My requirement is that, i have a file which contains the about 10 lines - say 1 2 3 ... 8 war of the worlds: => text in this line 9 9000,80,78,77,334,445 => this line contains some numbers separted by commas 10 ... (10 Replies)
Discussion started by: cool_boss2121
10 Replies

2. Shell Programming and Scripting

grep on specific line of the file

Hi, how can we search for a word (with case ignore )on specific line numbers ex: Awk /^regEX/ with condition on first line or second line Awk/^ regex1/ on line 1 Awk /^regEX2/ on line 3 thanks in advance (4 Replies)
Discussion started by: rider29
4 Replies

3. UNIX for Dummies Questions & Answers

Change Specific Line of a File

Hi everyone, I am attempting to do something that should be very simple. How do I replace a specific line of a file with different text, and then save that file to its original name? I believe I want to use the sed command with the c option, but I after trying many times, I can't get the right... (10 Replies)
Discussion started by: msb65
10 Replies

4. UNIX for Dummies Questions & Answers

Reading a specific line from a file

Hi All, I am having 100 lines a text file say a.txt. I want read the 'nth' line from that file inside a script. Kindly tell us how to that. (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

5. Shell Programming and Scripting

Using awk to read a specific line and a specific field on that line.

Say the input was as follows: Brat 20 x 1000 32rf Pour 15 p 1621 05pr Dart 10 z 1111 22xx My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour" I currently have this line but it is... (6 Replies)
Discussion started by: Bungkai
6 Replies

6. Shell Programming and Scripting

how read specific line in a file and write it in a new text file?

I have list of files in a directory 'dir'. Each file is of type HTML. I need to read each file and get the string which starts with 'http' and write them in a new text file. How can i do this shell scripting? file1.html <head> <url>http://www.google.com</url> </head> file2.html <head>... (6 Replies)
Discussion started by: vel4ever
6 Replies

7. Solaris

Insert a file at specific line

Hi, Anyone can help me in Solaris command on how to insert a file at specific line. I want file1.sql content to be inserted on file2.sh after "recover database using backup controlfile until cancel". # file1.sql /archivelogs/927_822338133.arc /archivelogs/671_822338107.arc... (3 Replies)
Discussion started by: fspalero
3 Replies

8. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

9. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
SETCAP(8)						      System Manager's Manual							 SETCAP(8)

NAME
setcap - set file capabilities SYNOPSIS
setcap [-q] [-v] (capabilities|-|-r) filename [ ... capabilitiesN fileN ] DESCRIPTION
In the absence of the -v (verify) option setcap sets the capabilities of each specified filename to the capabilities specified. The -v option is used to verify that the specified capabilities are currently associated with the file. The capabilities are specified in the form described in cap_from_text(3). The special capability string, '-', can be used to indicate that capabilities are read from the standard input. In such cases, the capabil- ity set is terminated with a blank line. The special capability string, '-r', is used to remove a capability set from a file. The -q flag is used to make the program less verbose in its output. EXIT CODE
The setcap program will exit with a 0 exit code if successful. On failure, the exit code is 1. SEE ALSO
cap_from_text(3), cap_set_file(3), getcap(8) 24th October 2008 SETCAP(8)
All times are GMT -4. The time now is 10:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy