Sponsored Content
Top Forums Shell Programming and Scripting Shell Script to read specific lines in a file Post 81600 by Ygor on Monday 22nd of August 2005 10:37:41 AM
Old 08-22-2005
Try...
Code:
awk 'BEGIN { FS = "[ :]" }
     $1 == "Record" { r = $2 }
     $1 == "ORA-00001" { print r }
    ' file1

 

10 More Discussions You Might Find Interesting

1. Programming

How to read specific lines in a bulk file using C file Programming

Please Help me I have a Bulk file containing Hex data I want to read specific lines from that bulk file by ID number. example ID DATE Time data 14 2005/09/28 07:40:08.546 0 5 078B1C 01916C 0FE59C 004B54 0A9670 0D04ED 05B6B4 0E2223... (10 Replies)
Discussion started by: rajan_ka1
10 Replies

2. Shell Programming and Scripting

A script that read specific fileds from the 7th line in a file

Dear All, I need a unix script that will read the 7th line and especially these fileds from a file Mo speed 16, Mt speed 15 every 15 minutes starting from 00:00 to 23:45 on daily basis and put the result in a txt file and name it MT_MO_20090225.txt, please also note that the system date format... (2 Replies)
Discussion started by: samura
2 Replies

3. Shell Programming and Scripting

How to use while loop in bash shell to read a file with 4 lines of gap

Hi , I am currently using the while loop in bash shell, as follows. while read line do echo $line done < file.txt However, i want to use the while loop on file.txt, which will read the file with 4 lines of gap. Ex- if file.txt is a file of 100 lines, then i want to use the loop such... (3 Replies)
Discussion started by: jitendriya.dash
3 Replies

4. Shell Programming and Scripting

Shell script to read lines in a text file and filter user data

hi all, I have this file with some user data. example: $cat myfile.txt FName|LName|Gender|Company|Branch|Bday|Salary|Age aaaa|bbbb|male|cccc|dddd|19900814|15000|20| eeee|asdg|male|gggg|ksgu|19911216||| aara|bdbm|male|kkkk|acke|19931018||23| asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies

5. Shell Programming and Scripting

Why does my script only read two lines of a file and not the third

I'm learning about the read command and wrote this little script to read data from a file: readfile() { while read variable; do echo $variable done } readfile < File.txt I have three lines in File.txt; each a single word. The script only echoes the first two lines and drops the... (9 Replies)
Discussion started by: Straitsfan
9 Replies

6. UNIX for Dummies Questions & Answers

How to use sed to copy specific lines from a file using shell variables?

hello! I am trying to use sed to copy specific set of lines from a file for which the starting and ending line numbers of the lines to be copied are stored in shell variables. How can i copy those lines? if the input_file is something like this and if the following is the script a=2 b=4... (4 Replies)
Discussion started by: a_ba
4 Replies

7. Shell Programming and Scripting

How to read from specific line number in shell script?

I have a text file which is having 30000 lines in it. I have to create a xml file for each 10000 lines until all the lines in the text files are written. Also please help how can i get number of lines in the text file in a shell variable? (19 Replies)
Discussion started by: vel4ever
19 Replies

8. Shell Programming and Scripting

How to change a number on a specific lines in a file with shell?

Hello My problem is that I want to change some specific numbers in a file. It is like, 2009 10 3 2349 21.3 L 40.719 27.388 10.8 FRO 7 0.8 1.1LFRO 2.6CFRO 1.1LMAM1 GAP=157 1.69 5.7 5.9 5.8 0.5405E+01 0.4455E+00 0.1653E+02E STAT SP IPHASW D HRMM SECON CODA AMPLIT... (11 Replies)
Discussion started by: miriammiriam
11 Replies

9. Shell Programming and Scripting

Read in specific lines in a file

I have a text file First title line name1 name2 name3 name4 (etc) other lines other lines other lines I want to read in this text file and parse the name1...name4 to a variable. How do I specificially read in these lines and these lines only? (10 Replies)
Discussion started by: piynik
10 Replies

10. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
cd_ptrec(3)						     Library Functions Manual						       cd_ptrec(3)

NAME
cd_ptrec, cd_cptrec - Reads the Path Table Record from the CD-ROM Path Table LIBRARY
Rock Ridge and X/Open Extensions to the CDFS library (libcdrom.so, libcdrom.a) SYNOPSIS
#include <sys/cdrom.h> int cd_ptrec ( char *path, struct iso9660_ptrec *ptrec ); int cd_cptrec ( char *path, char *addr ); PARAMETERS
Points to a file or directory within the CD-ROM File System hierarchy. Points to the iso9660_ptrec structure that holds the contents of the Path Table Record associated with the file or directory pointed to by *path. The iso9660_ptrec structure is defined in cdfs/xcdr.h, an include file that is called into sys/cdrom.h Specifies the address to which the function cd_cptrec copies the complete Path Table Record that is recorded on the CD-ROM. DESCRIPTION
The cd_ptrec routine fills the *ptrec structure with the contents of the Path Table Record associated with the directory that is pointed to by *path. The cd_cptrec function copies the complete Path Table Record that is recorded on the CD-ROM to the address pointed to by *addr. The user must allocate {CD_MAXPTRECL} bytes for the Path Table Record. The variable {CD_MAXPTRECL} is defined in cdfs/xcdr.h, an include file that is called into sys/cdrom.h. RETURN VALUES
If successful, the value zero is returned. If unsuccessful, the integer -1 is returned and errno is set to indicate the error. ERRORS
The function will fail if: Search permission is denied for a directory in *path or read permission is denied for the named directory. The address of *path or *addr is invalid. A signal was caught during execution of the function. The argument *path points to a file or direc- tory that is not within the CD-ROM file hierarchy. {OPEN_MAX} file descriptors are currently open in the calling process. [Tru64 UNIX] Either the OPEN_MAX value or the per-process soft descriptor limit is checked. The length of the *path string exceeds {PATH_MAX}, or a pathname component is longer than {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect. The system file table is full. A component of *path does not exist, or the *path argument points to an empty string. A component of the *path prefix is not a directory. The CD-ROM is not in the drive, or a read error occurred. RELATED INFORMATION
Files: cdfs/xcdr.h, sys/cdrom.h. delim off cd_ptrec(3)
All times are GMT -4. The time now is 01:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy