Sponsored Content
Full Discussion: Text Manipulation.
Top Forums Shell Programming and Scripting Text Manipulation. Post 302169731 by fpmurphy on Friday 22nd of February 2008 08:56:06 AM
Old 02-22-2008
Try the following:
Code:
#!/usr/bin/awk -f

BEGIN {
   msg_id=""
}

{
   if ($1 != msg_id) {
      if (msg_id != "")
          print outstr
      msg_id=$1; stime=$2
      outstr=" "$1" "$2" "$3
   } else
      outstr=outstr" "$2" ("$3-stime"s) "
}

END {
   print outstr
}

which gives the following output from the sample data you supplied
Code:
 1JRkPs-0008m8-Fd 7230901  domain.com (1s)  abc.com (60s)
 1JRkaH-0009E0-VZ 7231546  domain.co.uk (1s)
 1JRl5D-000AMD-22 7229863  123.com (1s)
 1JRl66-000AOR-AZ 7229918  xyz.co.za (1s)

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

text manipulation

I am tryin to figure out how to extract interested text from file example.txt blah blah blah a: child1 blah a: child2 blah b: parent1 blah blah blah .... blah a: child21 blah a: child22 blah a: child23 blah b: parent2 this kinda text repeats .. number of children is... (6 Replies)
Discussion started by: rajkishore
6 Replies

2. UNIX for Dummies Questions & Answers

Help with text manipulation

Hi there, I have some text files in unix format that processed by a program in windows, and when I open them with less or vi in linux, a warn for opening binary file is prompted, and as shown in vi, between every two characters there was inserted a "^@". How can I fix this. Plus, there are over... (2 Replies)
Discussion started by: dustinwang2003
2 Replies

3. UNIX for Dummies Questions & Answers

Text Manipulation

Greetings. Iīm a biologist and I donīt have mucho knowledge on Unix/Linux, but I need to use Cygwin to change some documents from a GenBank format to a FASTA format. GenBank format goes somthing like this: LOCUS NM_013964 2568 bp mRNA linear PRI 26-APR-2009... (2 Replies)
Discussion started by: vanesa1230
2 Replies

4. Shell Programming and Scripting

[HELP] Text manipulation... [HELP]

I need to know how can I remove all word after comma on each line. Like: jjkj,iiuiui,ijlkjkij,ookoo kijljlj,jhhkj,ijijkijkj,oijkijj kjkljlkj,kjkjlkjlkj,opok,okop to jjkj, kijljlj, ... (5 Replies)
Discussion started by: slutb3
5 Replies

5. UNIX for Dummies Questions & Answers

text manipulation help

Hello again unix.com How can I extract from a large file in format: steve@aol.com steve hawkins Location of this member is bla bla bla sun@hotmail.com Sun Ying This member is using browser bla bla bla to another text in format: steve@aol.com steve hawkins sun@hotmail.com sun ying ... (5 Replies)
Discussion started by: galford
5 Replies

6. UNIX for Dummies Questions & Answers

Text Manipulation Help

Hello Unix.com, I have a text in format: john sara lee How can I make it: john:john john:john1 john:john12 john:john123 sara:sara sara:sara12 sara:sara123 and so on (2 Replies)
Discussion started by: galford
2 Replies

7. UNIX for Dummies Questions & Answers

Text manipulation help

Hello unix.com users, I have a ip file (line-by-line). How can I delete the ips that keep repeating by mark XXX.XXX.XXX.* ... I want to erase only the lines that keep repeating more than 2 times. Example: 1.2.3.1 1.2.3.2 1.2.3.3 I want to erase all ips blocks that are repeating by C... (1 Reply)
Discussion started by: galford
1 Replies

8. UNIX for Dummies Questions & Answers

Text manipulation

i want to generate a list line-by-line of normal characters using letters . for example : dnds gnos mgod pets jnfp etc... i want to use all letters with all the posibilities is there a script that can do this ? (3 Replies)
Discussion started by: suppliernr1
3 Replies

9. Shell Programming and Scripting

Text manipulation help

Hello again, I have a problem manipulating a large text document and there is no way I could edit this document by hand. Format is: Address : XXXX N 37 Ave, Hollywood, FL, 33021 Phone: XXX3190XXX Player: XXXXXX Character: Jaramillo DOB: June-14-1995 ----- Name: Alexandra Ticket... (3 Replies)
Discussion started by: galford
3 Replies

10. Shell Programming and Scripting

Help text manipulation

Hello Forum , I need a help about text manupulation. I have a text file and I have to manipulate this file. Let's say source.txt source.txt UNB+UNOC:3+O0013000005MAN MN RVS:91+0098006688:92+190304:2313+F004169241' UNH+8146848+DELJIT:D:96A:UN' BGM+307:::JIS_SYNCRO_FIRM+2019030423234101+9'... (8 Replies)
Discussion started by: cemokam65
8 Replies
EvmVarGet(3)						     Library Functions Manual						      EvmVarGet(3)

NAME
EvmVarGet(), EvmVarGetOpaque(), EvmVarGetString(), EvmVarGetType(), EvmVarGetXxx(), EvmVarListFree(), EvmVarListGet(), EvmVarRelease(), EvmVarSet(), EvmVarSetOpaque(), EvmVarSetStringI18N(), EvmVarSetXxx() - manipulate event variables SYNOPSIS
Library EVM Support Library Parameters event The event to be processed. v_name The name of a variable in the event for which data is to be set or obtained. For if the named variable exists, the associated data is modified. If the variable does not exist, it is created and added to the event. The value to be stored is passed in item_value. type The enumeration constant for the type of the item_value to be stored in the variable indicated by v_name. Possible values for this field are: For the type operand is a returned value. item_value The value to be stored in the variable indicated by v_name. msg_id For a string variable being set in an internationalized event, msg_id may contain an I18N (internationalization) message iden- tifier corresponding to the value of the variable. The identifier must refer to a message in the catalog and message set asso- ciated with the event (see the EvmItemSet(3) manpage). The msg_id operand is ignored for variables whose type is not size The size of the associated item_value in bytes. The caller must specify the correct size when setting a variable of type For all other variable types, the size is ignored. var For the routine, this is a pointer to the location where the output data is to be stored. For the routine, this is a pointer to the storage space to be released. var_count This is the number of names in the var_list obtained by not including the terminating NULL pointer. varlist On return from the routine, this is a list of pointers to the names of the variables associated with the event. The last item in the list is a NULL pointer. For the routine, this is a list of names of variables for which memory should be freed. The list must be terminated by a NULL pointer. DESCRIPTION
The routine sets the value of a variable data item, indicated by v_name, in an event. This routine is used both for adding a variable and for altering its value. If the v_name variable is not already present in the event, it is added. The and routines offer a simpler means of setting a variable than the generic routine. Using these routines, a single call can set a vari- able of any type. To use these routines, replace the Xxx() in the routine name with the required type name, and supply a value of the cor- responding type as the item_value operand. The following types are supported: Boolean, Char, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64, Float, Double, String. Use to set a string variable with a non-zero I18N message-ID. Use to set an opaque variable. Each of these routines requires one more op- erand than the others in this group. The routine returns the event variable indicated by v_name in the var variable. The caller must free any space used by the variable by calling The routine returns the type of the named variable. The and routines offer a simpler means of retrieving a variable value than the generic routine. These routines can retrieve a variable of a specific type with a single call. To use these routines, replace the Xxx() in the routine name with the required type name, and supply a pointer to a location of the corresponding type as the item_value pointer. Refer to the description of above for details of the supported types. Use to retrieve a string variable, specifying NULL for the msg_id operand if you do not want to receive an I18N message-ID. Use to retrieve an opaque variable. Each of these routines requires one more operand than the others in this group. Note that and return their variable values in heap memory. Use to free this space when it is no longer needed. The routine releases any storage space allocated when the specified var was retrieved from an event using It is important that this routine is called when the variable is no longer needed to ensure that all memory associated with the variable is released. Do not use this rou- tine to release variables retrieved with any of the routines. The routine returns, in the varList reference argument, a pointer to an array of pointers to names of all the variables contained in the event. The last entry in the array is a NULL pointer. The var_count argument receives the number of names in the list, not counting the terminating null value. The caller must free the memory used by the list by calling The routine frees the memory used by a variable list (varList). Notes The caller must specify the size when adding an opaque variable to an event. To avoid memory leakage, memory that is supplied to the caller from API routines must be freed with the appropriate routine. RETURN VALUE
The operation completed without error. One of the arguments to the function is invalid. A value in a structure member is invalid. An operation failed because an attempt to acquire heap memory failed. A request specified an item or variable name component in an or a that is not part of the event being processed. ERRORS
The value of is not set. SEE ALSO
Event Management EVM(5). EVM Events EvmEvent(5) EvmVarGet(3)
All times are GMT -4. The time now is 04:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy