Sponsored Content
Full Discussion: Get line number in flat file
Top Forums Shell Programming and Scripting Get line number in flat file Post 302782021 by ctsgnb on Monday 18th of March 2013 07:45:13 AM
Old 03-18-2013
Code:
awk '/^Pcode/{print NR;exit}' yourfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to get rid of blank line in a flat text file

Hi, I have a flat text file which contains blank line between each text line. Is there any command to get rid of it? Thanks for your help (11 Replies)
Discussion started by: xfang
11 Replies

2. Shell Programming and Scripting

how to get the data from line number 1 to line number 100 of a file

Hi Everybody, I am trying to write a script that will get some perticuler data from a file and redirect to a file. My Question is, I have a Very huge file,In that file I have my required data is started from 25th line and it will ends in 100th line. I know the line numbers, I need to get all... (9 Replies)
Discussion started by: Anji
9 Replies

3. UNIX for Dummies Questions & Answers

how to remove the first line from a flat file ?

Hi, I want to remove the first line from a flat file using unix command as simple as possible. Can anybody give me a hand ? Thanks in advance. xli (21 Replies)
Discussion started by: xli
21 Replies

4. AIX

How to cut a flat file according to a certain number of characters?

hello everybody i am looking for a shell to cut a flat file (with a long unique line) according to a certain number of characters and redirect every result to an output file. here is an example MyFile : 12 3 456 12 3 456 12 3 456 ..... and i took every 9-characters including BLANKS... (6 Replies)
Discussion started by: fastlane3000
6 Replies

5. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

6. Shell Programming and Scripting

Read flat file upto certain number of columns

Hello Guys Please help me with the below issue I want to read a flat file source upto certain number of columns Say my flat file has 30 columns but I want to read upto 25 columns only How come the above issue can be addressed? Thanks a lot!!!! (1 Reply)
Discussion started by: Pratik4891
1 Replies

7. Shell Programming and Scripting

search a string in a particular column of file and return the line number of the line

Hi All, Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example : abc.txt 7000,john,2,1,0,1,6 7001,elen,2,2,0,1,7 7002,sami,2,3,0,1,6 7003,mike,1,4,0,2,1 8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies

8. UNIX for Dummies Questions & Answers

Inserting a sequential number into a field on a flat file

I have a csv flatfile with a few million rows. I need to replace a field (field number is 85) in the file with a sequential number. As an example, let's assume there are only 4 fields in the file: A,A,,32 A,A,,27 A,B,,43 C,C,,354 If I wanted to amend the 3rd field in this way my... (2 Replies)
Discussion started by: BristolSmithy
2 Replies

9. Shell Programming and Scripting

Replace first number of each line in a file with another number

Hi, I have a set of files in a directory that I have to read and replace the first occurrence of a number with another dummy number. This is what I have so far but it does not seem to work. The files have lot of other data in each row and each data element is separated by ,@, for file in... (13 Replies)
Discussion started by: scorpioraghu
13 Replies

10. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies
DBASE_GET_HEADER_INFO(3)						 1						  DBASE_GET_HEADER_INFO(3)

dbase_get_header_info - Gets the header info of a database

SYNOPSIS
array dbase_get_header_info (int $dbase_identifier) DESCRIPTION
Returns information on the column structure of the given database link identifier. PARAMETERS
o $dbase_identifier - The database link identifier, returned by dbase_open(3) or dbase_create(3). RETURN VALUES
An indexed array with an entry for each column in the database. The array index starts at 0. Each array element contains an associative array of column information, as described here: o name - The name of the column o type - The human-readable name for the dbase type of the column (i.e. date, boolean, etc.) o length - The number of bytes this column can hold o precision - The number of digits of decimal precision for the column o format - A suggested printf(3) format specifier for the column o offset - The byte offset of the column from the start of the row If the database header information cannot be read, FALSE is returned. EXAMPLES
Example #1 Showing header information for a dBase database file <?php // Path to dbase file $db_path = "/tmp/test.dbf"; // Open dbase file $dbh = dbase_open($db_path, 0) or die("Error! Could not open dbase database file '$db_path'."); // Get column information $column_info = dbase_get_header_info($dbh); // Display information print_r($column_info); ?> PHP Documentation Group DBASE_GET_HEADER_INFO(3)
All times are GMT -4. The time now is 04:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy