Sponsored Content
Full Discussion: Row number
Top Forums UNIX for Dummies Questions & Answers Row number Post 302778605 by coolmaninit on Monday 11th of March 2013 10:08:01 AM
Old 03-11-2013
Quote:
Originally Posted by sam05121988
Code:
sed -n '<Record Number>p' file

eg: 51 st record
Code:
sed -n '51p' file


Do you have any script to put in batch mode.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK: row number NR

Hi I've file1 as: after I read all rows with awk, I need to change some of them. I mean, for example if the last row is zero then change row number 4 in zero too. So I'd like to refers each row as a vector and change its value accordly some conditions. I know that NR keep just the "current"... (2 Replies)
Discussion started by: Dedalus
2 Replies

2. Shell Programming and Scripting

removing files with certain number in the first row

Hello! I have 32000 files in a directory and want to remove those with first row beging with 0.00; file names are in numbers from 1 through 32000; I have coded the following but it gives me error: while ( i <= 32000 ) if (head -1 $i ==0.00) rm $i end Well, i am sure even if this... (14 Replies)
Discussion started by: nxp
14 Replies

3. UNIX for Dummies Questions & Answers

deleting a row if a certain column is below a certain number

How can you delete a row if a certain column is bigger than a certain number? I have the following input: 20080709 20081222 95750 1 0 0.02 94.88 20080709 20081222 95750 2 0 0.89 94.88 20080709 20081222 9575 1 0 0 94.88 20080709 20081222 9575 2 0 0 94.88 20080709 20081222 9587.5 1 0 0... (6 Replies)
Discussion started by: Pep Puigvert
6 Replies

4. UNIX for Dummies Questions & Answers

To find the Row number

Hi Can any one tell me what is the command to find out the row id or row number for a particular record Thanks sri (6 Replies)
Discussion started by: laxmi131
6 Replies

5. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

6. Shell Programming and Scripting

The difference between end number in the early row and the start number in the next

Hi Power User, I'm trying to compute this kind of text file format: file1: jakarta 100 150 jakarta 170 210 beijing 220 250 beijing 260 280 beijing 290 320 new_york 330 350 new_york 370 420 tokyo 430 470 tokyo 480 ... (2 Replies)
Discussion started by: anjas
2 Replies

7. UNIX for Dummies Questions & Answers

Finding row number along with length of row

I have a fixed length file and I want to find out row number along with row length. I have a program that give me the line length if it satisfy the condition; but i would like to add row number as well? How do I do that? while IFS= read -r line; do if ; then echo ${line} echo... (8 Replies)
Discussion started by: princetd001
8 Replies

8. Shell Programming and Scripting

Need row number with Xml tags value

Hi, Need help. My source file contain data like: 1 <?xml version="1.0"?> <Status>EGZAAE09</Status><Perform>002</Perform><DATE>2013-05-27</DATE> 1 <?xml version="1.0"?> <Status>ECBAE09</Status><Perform>002</Perform><DATE>2013-05-27</DATE> 2 <?xml version="1.0"?>... (3 Replies)
Discussion started by: sene_geet
3 Replies

9. Shell Programming and Scripting

Get row number from file1 and print that row of file2

Hi. How can we print those rows of file2 which are mentioned in file1. first character of file1 is a row number.. for eg file1 1:abc 3:ghi 6:pqr file2 a abc b def c ghi d jkl e mno f pqr ... (6 Replies)
Discussion started by: Abhiraj Singh
6 Replies

10. Shell Programming and Scripting

Read row number from 1 file and print that row of second file

Hi. How can I read row number from one file and print that corresponding record present at that row in another file. eg file1 1 3 5 7 9 file2 11111 22222 33333 44444 55555 66666 77777 88888 99999 (3 Replies)
Discussion started by: Abhiraj Singh
3 Replies
ggLoadConfig(3) 							GGI							   ggLoadConfig(3)

NAME
ggLoadConfig, ggFreeConfig, ggConfigIterTarget, ggConfigIterLocation - Configuration helpers SYNOPSIS
int ggLoadConfig(const char *file, gg_config *config); void ggFreeConfig(gg_config config); struct gg_location_iter { struct gg_iter iter; const void * config; const char * name; char * location; const char * symbol; void * _state; }; int ggConfigIterLocation(struct gg_location_iter * iter); struct gg_target_iter { struct gg_iter iter; void * config; const char * input; char * target; char * options; void * nested; }; int ggConfigIterTarget(struct gg_target_iter *iter); DESCRIPTION
These functions provides a simple way of handling configuration files. ggLoadConfig tries to load the configuration file given as parameter. It adds the content to the config handle found at *config. If the handle is NULL, a new one is created. ggFreeConfig deletes the internal structure for the configuration handle config. This handle becomes invalid and should not be used any- more. ggConfigIterLocation allows to retreive the location and symbol associated to canonical names. This function is mainly used together with the scope abstraction to query application modules at runtime. This function will prepare the iter structure to be used as an iterator that will generate correct matches. iter is a pointer to a gg_location_iter structure owned by the caller. This user part of the structure must be set by the caller before calling ggConfigIterLocation. The config field must be filled with the config handle which contains target information; the name field must be filled with the canonical name that is being looked for. location and symbol are placeholders in which the results will be found along the iteration. The resulting strings *do* belong to libgg and *must not* be freed or altered, and they may be invalidated if not used during the iteration process. They must be copied if needed later. _state is an internal opaque pointer that keeps track of the iterator state. Its value must never be touched by the caller. ggConfigIterTarget allows to iterate over canonical target names and options strings found in a target spec string. This function also work as a generator. iter is a pointer to a gg_target_iter structure owned by the caller. This user part of the structure must be set by the caller before calling ggConfigIterTarget. The config field must be filled with the config handle which contains target information; the input field must be filled with the initial input spec string. target and options are placeholders in which the results will be found along the iteration. Here again, the resulting strings *do* belong to libgg and *must not* be freed or altered, and they may be invali- dated if not used during the iteration process. They must be copied if needed later. nested is an internal opaque pointer that keeps track of the iterator state. Its value must never be touched by the caller. RETURN VALUE
ggLoadConfig returns GGI_OK on success, or: o GGI_ENOMEM if it can not allocate a new configuration handle. Note that if subsequent memory allocations fail (when feeding the han- dle), those will not be reported as an error. The handle will be incomplete with regard to the config file contents; o GGI_ENOTFOUND if the file does not exists. Note that missing files in include directives will not be reported an error. Also, other parse error in the file will simply cause the incriminated lines to be ignored. ggConfigIterLocation returns GGI_OK on success or GGI_ENOMEM. ggConfigIterTarget always return GGI_OK and will never fail. CONFIG FILE FORMAT
The configuration file is line oriented. Each line may define a mapping between a canonical name and a location. The generic format is: <pattern> <location>[:<symbol>] alias <name> <expansion> On the first line pattern is a canonical name that may contain one * as a wildcard, location is a string that corresponds to a scope loca- tion, and symbol is an optional string that gives the name of the symbol to retreive from the scope. If not given, NULL will be reported. The second line defines an alias. When a target called name is found while iterating over target spec strings, the iterator parse expansion as a sub-input spec, and aggregate all option strings that where found on upstream aliases. In addition, the configuration file loader knowns the following directives: .root <path> .include <file> When locations following the .root directive are given as relative path, path will be prepended. .include will parse the given file recur- sively, before continuing with the current one. EXAMPLE
This code demonstrates how to get the first module init function accessible from a scope for a given name. It also shows how to use the libgg iterator scheme: int openModule(gg_config cfg, const char * moduleName, const char * defaultSymbol) { struct gg_location_iter match; gg_scope scope; module_init_func *init; /* prepare the iterator */ match.name = name; match.config = cfg; ggConfigMatchIter(&match); /* iterate over the matches */ GG_ITER_FOREACH(&match) { /* try to retreive the collection at suggested location */ if((scope = ggGetScope(match.location)) == NULL) continue; /* use default symbol if none suggested */ if (match.symbol == NULL) match.symbol = defaultSymbol; /* try to retreive the symbol from that scope */ if((init = ggFromScope(scope, match.symbol)) == NULL) { ggDelScope(scope); continue; } /* try to initialize the module */ if(init() != GGI_OK) { ggDelScope(scope); continue; } /* the module is up, abort iteration and return */ GG_ITER_DONE(&match); return GGI_OK; } /* module not found */ GG_ITER_DONE(&match); return GGI_ENOTFOUND; Note that this code is not completely correct, because the scope cannot be deleted later if it is not remembered somewhere. This next example shows how to list all targets and options specified by a string: static void showAllTargets(void * cfg, const char * input) { struct gg_target_iter match; match.config = cfg; match.input = input; ggConfigIterTarget(&match); GG_ITER_FOREACH(&match) { printf("Target "%s" with options "%s". ", match.target, match.options); } GG_ITER_DONE(&match); } SEE ALSO
ggGetScope(3) libgg-1.0.x 2005-08-26 ggLoadConfig(3)
All times are GMT -4. The time now is 03:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy