Sponsored Content
Full Discussion: How to use awk substr ?
Top Forums Shell Programming and Scripting How to use awk substr ? Post 98761 by sabercats on Friday 10th of February 2006 05:14:54 PM
Old 02-10-2006
How to use awk substr ?

Hi all,

I have a flatfile
Quote:
CTI-ProgramStart|VVV2|Program Start|VKGXXXXXXXX|VKGXXXXXX|06/01/22 00:33:49.467|WSSACCCXXXX|VVV21137XXX3|B Program Version:.6.4.5 AgentID:2247 Password: Signature: Extention:7950 PeripheralID:2 SideAHost:109.XX.XX.XX SideBHost:192.XX.XX.XX SideAPort:42027 SideBPort:5874 HEARTBEATINTERVAL:-1 EXPECTEDCLIENTS:150 QUEUESIZE:32 POOLSIZE=64 SERVICESMASK:-214749088 EVENTSMASK:311071 STATUSMASK:1031 TRACEMASK:5|
I would like to get ext = 7950 , how do I do that ?


if ($1 == "CTI-ProgramStart") {
ext = substr($9,index($9,"Extension")+11,4);


But why it is not working ???? Please help .
Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk substr?

Sorry if this has been posted before, I searched but not sure what I really want to do. I have a file with records that show who has logged into my application: 2003-03-14:I:root: Log_mesg: registered servername:userid. (more after this) I want to pull out the userid, date and time into... (2 Replies)
Discussion started by: MizzGail
2 Replies

2. UNIX for Dummies Questions & Answers

awk or substr

i have a variable 200612 the last two digits of this variable should be between 1 and 12, it should not be greater than 12 or less than 1 (for ex: 00 or 13,14,15 is not accepted) how do i check for this conditions in a unix shell script. thanks Ram (3 Replies)
Discussion started by: ramky79
3 Replies

3. Shell Programming and Scripting

awk substr

Hi I have multiple files that name begins bidb_yyyymm. (yyyymm = current year month of file creation). What I want to do is look at the files and where yyyymm is older than 1 month I want to remove the file from the server. I was looking at looping through the files and getting the yyyymm... (2 Replies)
Discussion started by: colesga
2 Replies

4. UNIX for Dummies Questions & Answers

substr first element using awk

I have a variable '$test' that has the following string value: $test = 123|456|789|0123 How would I select just the first element ('123') using awk. Note: '|' is the delimiter, and the length of each field can vary. Thanks, - CB (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

5. Shell Programming and Scripting

Help with awk and substr

I have the following to find lines matching "COMPLETE" and extract parts of it using substr. sed -n "/COMPLETE/p" 1.txt | awk 'BEGIN { FS = "\" } {printf"%s %s:%s \n", substr($3,17,3),substr($6,4,1), substr($7,4,1)}' | sort | uniq > temp.txt Worked fine until the numbers in 2nd & 3rd substr... (5 Replies)
Discussion started by: zpn
5 Replies

6. Shell Programming and Scripting

awk substr

HI I am using awk and substr function to list out the directory names in the present working directory . I am using below code ls -l | awk '{ if ((substr($1,1,1)) -eq d) {print $9 }}' But the problem is i am getting all the files and directories listed where as the requirement i wrote... (7 Replies)
Discussion started by: prabhu_kumar
7 Replies

7. Shell Programming and Scripting

Substr with awk

Hi to all, I'm here again, cause I need your help to solve another issue for me. I have some files that have this name format: date_filename.csv In my shell I must rename each file removing the date so that the file name is filename.csv To do this I use this command: fnames=`ls ${fname}|... (2 Replies)
Discussion started by: leobdj
2 Replies

8. Shell Programming and Scripting

awk substr

Hello life savers!! Is there any way to use substr in awk command for returning one part of a string from declared start and stop point? I mean I know we have this: substr(string, start, length) Do we have anything like possible to use in awk ? : substr(string, start, stop) ... (9 Replies)
Discussion started by: @man
9 Replies

9. Shell Programming and Scripting

HELP : awk substr

Hi, - In a file test.wmi Col1 | firstName | lastName 4003 | toto_titi_CT- | otot_itit - I want to have only ( colones $7,$13 and $15) with code 4003 and 4002. for colone $13 I want to have the whole name untill _CT- or _GC- 1- I used the command egrep with awk #egrep -i... (2 Replies)
Discussion started by: georg2014
2 Replies

10. Shell Programming and Scripting

awk and substr

Hello All; I have an input file 'abc.txt' with below text: 512345977,213458,100021 512345978,213454,100031 512345979,213452,100051 512345980,213455,100061 512345981,213456,100071 512345982,213456,100091 512345983,213457,100041 512345984,213451,100011 I need to paste the first field... (10 Replies)
Discussion started by: mystition
10 Replies
PAPI_get_executable_info(3)					       PAPI					       PAPI_get_executable_info(3)

NAME
PAPI_get_executable_info - Get the executable's address space info. SYNOPSIS
Detailed Description @par C Interface: const PAPI_exe_info_t *PAPI_get_executable_info( void ); This function returns a pointer to a structure containing information about the current program. @param fullname Fully qualified path + filename of the executable. @param name Filename of the executable with no path information. @param text_start, text_end Start and End addresses of program text segment. @param data_start, data_end Start and End addresses of program data segment. @param bss_start, bss_end Start and End addresses of program bss segment. @retval PAPI_EINVAL One or more of the arguments is invalid. @par Examples: * const PAPI_exe_info_t *prginfo = NULL; * if ( ( prginfo = PAPI_get_executable_info( ) ) == NULL ) * exit( 1 ); * printf( "Path+Program: %s0, exeinfo->fullname ); * printf( "Program: %s0, exeinfo->address_info.name ); * printf( "Text start: %p, Text end: %p0, exeinfo->address_info.text_start, exeinfo->address_info.text_end) ; * printf( "Data start: %p, Data end: %p0, exeinfo->address_info.data_start, exeinfo->address_info.data_end ); * printf( "Bss start: %p, Bss end: %p0, exeinfo->address_info.bss_start, exeinfo->address_info.bss_end ); * See Also: PAPI_get_opt PAPI_get_hardware_info PAPI_exe_info_t Author Generated automatically by Doxygen for PAPI from the source code. Version 5.2.0.0 Tue Jun 17 2014 PAPI_get_executable_info(3)
All times are GMT -4. The time now is 11:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy