Sponsored Content
Top Forums Shell Programming and Scripting get lines with multiple values at a position Post 302179119 by deepakgang on Thursday 27th of March 2008 03:33:03 AM
Old 03-27-2008
Hi All,

If i have a similar file with no commas to separate the fields, is there any way:

1001DEFG,40000
2002KGRG,3000
2002HDGD,3454
4564GRTR,5656
4659GGTD,10002


to get :

2002KGRG,3000
2002HDGD,3454
4659GGTD,10002

Where i have to get lines based on the first four digits of each line.

Thanks,
D
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH: extracting values from multiple lines after a match

Hi there, I have the following output, # raidctl -l RAID Volume RAID RAID Disk Volume Type Status Disk Status ------------------------------------------------------ c0t1d0 IM OK c0t1d0 OK ... (4 Replies)
Discussion started by: rethink
4 Replies

2. Shell Programming and Scripting

how to Insert values in multiple lines(records) within a pipe delimited text file in specific cols

this is Korn shell unix. The scenario is I have a pipe delimited text file which needs to be customized. say for example,I have a pipe delimited text file with 15 columns(| delimited) and 200 rows. currently the 11th and 12th column has null values for all the records(there are other null columns... (4 Replies)
Discussion started by: vasan2815
4 Replies

3. Programming

C program - convert values based on the position

Hey! I'm new to C. I need to covert certain values using C. please see the below. I have figured out the logic to do it. Please provide some hints to do this with C Logic: If first position of POS = 0, shift POS to the left one byte. If third position of POS = 0, move spaces to third... (1 Reply)
Discussion started by: rocker_me2002
1 Replies

4. Shell Programming and Scripting

[Solved] How do i deal with values on multiple lines?

Hi, I have a file which has the contents: sh-4.2# pwd /tmp sh-4.2# cat servernfiles server1 /var/tmp/file server2 /var/tmp/file1 I want to manage each line one after the other. I have this basic script : #!/bin/sh HOST=`cat /tmp/servernfiles | awk '{print $1}'` CMD=`cat... (6 Replies)
Discussion started by: chandika_diran
6 Replies

5. Shell Programming and Scripting

[Solved] Counting The Number of Lines Between Values with Multiple Variables

Hey everyone, I have a bunch of lines with values in field 4 that I am interested in. If these values are between 1 and 3 I want it to count all these values to all be counted together and then have the computer print out LOW and the number of lines with those values in between 1 and 3,... (2 Replies)
Discussion started by: VagabondGold
2 Replies

6. Shell Programming and Scripting

Reading multiple values from multiple lines and columns and setting them to unique variables.

Hello, I would like to ask for help with csh script. An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Discussion started by: FMMOLA
7 Replies

7. Shell Programming and Scripting

Need command or script to print all lines from 2nd position to last but one position

hi guys, i want command or script to display the content of file from 2nd position to last but one position of a file abcdefghdasdasdsd 123,345,678,345,323 434,656,656,656,656 678,878,878,989,545 4565656667,65656 i want to display the same above file without first and... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

8. Shell Programming and Scripting

Removing multiple lines from input file, if multiple lines match a pattern.

GM, I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed. I am assuming that sed, awk or even perl could do what I need. I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies

9. Shell Programming and Scripting

How to retrieve values from XML file and update them in the same position! PLEASE HELP?

Good Day All Im quiet new to ksh scripting and need a bit of your help. I am attempting to write a script that reads in an XML and extracts certain field values from an XML file. The values are all alphanumeric and consist of two components: e.g "Test 1". I need to to create a script that... (2 Replies)
Discussion started by: JulioAmerica
2 Replies

10. Shell Programming and Scripting

Cut command with dynamic passing of delimiter and position values

Hi All, We have a requirement of picking nth position value by using cut command. value would be delimited by any symbols. We have to pass delimited value and postition to get the value in a string. ex. echo "A,B,C,D,E" |cut -d "," -f3 echo "A|B|C|D|E"|cut -d "|" -f2 Kindly frame the... (5 Replies)
Discussion started by: KK230689
5 Replies
XDF_SET_CONF(3) 					     xdffileio library manual						   XDF_SET_CONF(3)

NAME
xdf_set_conf, xdf_get_conf - set or get the configuration of xDF file SYNOPSIS
#include <xdfio.h> int xdf_set_conf(struct xdf* xdf, enum xdffield field, ...); int xdf_get_conf(const struct xdf* xdf, enum xdffield field, ...); DESCRIPTION
xdf_set_conf() sets the configuration (usually one of the field file header) of a xDF file referenced by xdf according to the variable list of arguments. This list is composed of successive couple grouping one variable of type enum xdffield defining the feature to be set and a value whose type depends on the previous field type. The list must finish by XDF_NOF. xdf_get_conf() gets the configuration of the channel referenced by xdf according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_conf() excepting that the second part of the couple is not that value but a pointer to the value. Both functions process the argument list from left to right. This means that if a particular field request provokes an error, none of the field requests on its right will be processed. The order of processing is also important for field requests that influences the value of other fields (like XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ). The functions accepts two types of field value. The first one are file configuration field (XDF_F_*) which set different aspects of the general configuration of the file. The second type are the channel configuration fields (XDF_CF_*). When used in xdf_set_conf(), those fields set the default values that will be used for the creation of the next channel (see xdf_add_channel(3)). The list of channel configu- ration fields and their meaning are specified in the documentation of xdf_set_chconf(3). If the file is opened for writing, each field is initialized to sensible or non-informative values in case of optional field or incorrect values in the case of "must be set" field (only XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ). The default value are specified in squared bracked in the list. Here is the list of file configuration field value. The type of value expected is provided in the parenthesis (the expected type of the value for xdf_set_conf(), or a pointer to this type for xdf_get_conf()). If a list of data formats is specified in curl brackets, it means that the field is supported only in those formats (no list means that all formats support the field): XDF_F_REC_DURATION (double) [1] Specify the duration of one record. The value should be positive. XDF_F_REC_NSAMPLE (int) [0] Specify the number of time points contained in each record. The value should be positive. Setting the number of sample per record modifies the sampling frequency (field XDF_SAMPLING_FREQ). XDF_F_SAMPLING_FREQ (int) [0] Get or set the sampling frequency of the recording. Setting the sampling frequency modifies the number of sample per record (field XDF_F_REC_NSAMPLE). XDF_F_NCHANNEL (int) (get function only) Get the number of channel in the file. XDF_F_NEVTTYPE (int) (get function only) Get the number of different event types. XDF_F_NEVENT (int) (get function only) Get the number of events. XDF_F_FILEFMT (int) (get function only) Get the file format type (one of the value defined by the enumeration xdffiletype other than XDF_ANY) XDF_F_RECTIME (double) [current time] {EDF BDF GDF} Date and time of recording. It is expressed as number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). This num- ber is the convertion to double of the value returned by the function time(3) of the standard C library. On file creation, this field is initialized to the current time. XDF_F_SUBJ_DESC (const char*) [""] {EDF BDF GDF} Specify the string describing the subject. XDF_F_SESS_DESC (const char*) [""] {EDF BDF GDF} Specify the string describing the session of recording. XDF_F_ADDICTION (unsigned int) [0] {GDF} XDF_F_BIRTHDAY (double) [0] {GDF} Birthday of the patient using the same format as specified for field XDF_F_RECTIME. XDF_F_HEIGHT (double) [0] {GDF} Height of the subject in centimeters. XDF_F_WEIGHT (double) [0] {GDF} Weight of the subject in kilograms. XDF_F_GENDER (unsigned int) [0] {GDF} Sex of the subject. Use 1 for male, 2 for female and 0 if unknown. XDF_F_HANDNESS (unsigned int) [0] {GDF} Handness of the subject. Use 0 if unknown, 1 if right, 2 if left and 3 if ambidextrious. XDF_F_VISUAL_IMP (unsigned int) [0] {GDF} Visual impairment. Use 0 if unknown, 1 if no impairment, 2 if impaired and 3 if impaired but corrected. XDF_F_HEART_IMP (unsigned int) [0] {GDF} Heart impairment. Use 0 if unknown, 1 if no impairment, 2 if impaired and 3 if the subject wear a pacemaker. XDF_F_LOCATION (double[3]) [0,0,0] {GDF} Location of the recording. The first 2 component specify the latitude and longitude in degrees, the third specifies the altitude in meters. XDF_F_ICD_CLASS (char[6]) [0x000000000000] {GDF} Patient classification according to the International Statistical Classification of Diseases and Related Health Problems (ICD). XDF_F_HEADSIZE (double[3]) [0,0,0] {GDF} Size of the subject's head (circumference, distance nasion - inion, left to right mastoid) expressed in millimeters. XDF_F_REF_POS (double[3]) [0,0,0] {GDF} X, Y, Z coordinates of the reference electrode. XDF_F_GND_POS (double[3]) [0,0,0] {GDF} X, Y, Z coordinates of the ground electrode. RETURN VALUE
The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately. ERROR
EINVAL xdf is NULL or field is not a proper value of the enumeration xdffield accepted by the function (for example XDF_F_NCHANNEL and xdf_set_conf() ) EPERM The request submitted to xdf_set_conf() is not allowed for this type of xDF file or is not supported with the mode XDF_READ. EXAMPLES
Example of usage of xdf_set_conf() and xdf_get_conf(): /* Assume xdfr and xdfw reference 2 XDF files opened respectively * for reading and for writing */ const char *subjstr, *sessstr; xdf_get_conf(xdfr, XDF_F_SUBJ_DESC, &subjstr, XDF_F_SESS_DESC, &sessstr, XDF_NOF); printf("subject: %s recording: %s ", subjstr, sessstr); xdf_set_conf(xdfw, XDF_F_SUBJ_DESC, subjstr, XDF_F_SESS_DESC, sessstr, XDF_NOF); SEE ALSO
xdf_copy_conf(3), xdf_set_chconf(3), xdf_add_channel(3) EPFL
2010 XDF_SET_CONF(3)
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy