Sponsored Content
Top Forums Shell Programming and Scripting Regexp to separated rows by "asterisks-new line" in awk Post 302782475 by Scrutinizer on Tuesday 19th of March 2013 02:20:44 AM
Old 03-19-2013
Note: only in gawk and mawk can RS contain a regex. Regular awk only supports a single character.

Last edited by Scrutinizer; 03-19-2013 at 02:51 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

How to cut a file using " ", but fields can be separated with more than one " "

Hello, let's say I have a text file: word11 word12 word13 word21 word22 word23 word31 word32 word33 and I want to put the second field of each line into a list: set list = `cut -d" " -f2 ${1}` and I use space (" ") as a delimiter, only that there's a catch: there can be more than... (12 Replies)
Discussion started by: shira
12 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. Shell Programming and Scripting

AWK for multiple line records RS="^" FS="#"

I have to pull multiple line records with ^ as the record separator(RS)... # should be my field separator (FS)... Sample record is: ^-60#ORA-00060: deadlock detected while waiting for resource ORA-00001: unique constraint (SARADM.TCKNUM_PK) violated#PROC:AVAILABLE_FOR_GETNXTTIC#02/27/2012... (7 Replies)
Discussion started by: Vidhyaprakash
7 Replies

7. Shell Programming and Scripting

awk :help to parse a file to change to separated by colon ":"

Hi experts , I am trying to get the below output: file : 0/6/4/1 0x0019503C2E26 5 UP lan5 snap5 1 ETHER Yes 224 0/6/4/0 0x0019503C2E25 6 UP lan6 snap6 2 ETHER Yes 224 0/2/1/0 0x0019503E6900 0 UP lan0 snap0 3 ETHER Yes 224... (8 Replies)
Discussion started by: rveri
8 Replies

8. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

9. Shell Programming and Scripting

Failure: if grep "$Var" "$line" inside while read line loop

Hi everybody, I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o My code: #!/bin/sh set -e set -u export IFS= optl="Optl" LOCSTORCLI="/opt/lsi/storcli/storcli" ($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies
XtNameToWidget()														  XtNameToWidget()

Name
  XtNameToWidget - find a named widget.

Synopsis
  Widget XtNameToWidget(reference, names);
	 Widget reference;
	 String names;

Inputs
  reference Specifies the widget from which the search is to start.  Must be of class Core or any subclass.

  names     Specifies the partially qualified name of the desired widget.

Returns
  A child of reference that matches names.

Description
  XtNameToWidget()  returns a descendant of the reference widget whose name matches the specified names.  The names argument specifies a sim-
  ple object name or a series of simple object name components separated by periods or asterisks.  Asterisks have the same  meaning  to  this
  function as they do in a resource file.

  The "Algorithm" section below explains the procedure XtNameToWidget() uses to find the named child.

Usage
  If  you  want  to look up an immediate child of a widget, simply pass the widget and the child's unqualified name.  If you need to lookup a
  descendant, you can provide a fully qualified name to that descendant, or if you don't know the full name, or if you don't  even  know  how
  many levels removed that descendant is, you can use an asterisk before the name.

  Note that if there is more than one child with the specified name, it is undefined which will be returned.

  You  can  use XtNameToWidget() to hide the details of a user interface and for modular programming.  If module A creates an interface which
  contains a text widget, and module B need to get the contents of the text widget, module A could export the text widget in a	global	vari-
  able,  or instead, it could simply define the name of the text widget as part of the module definition.  Then module B, or any other module
  could look up that widget with XtNameToWidget() when it is needed.  Because XtNameToWidget() supports  wildcarding,  module  A  can  freely
  change the details of the widget hierarchy it creates as long as the name of the text widget remains unique.

Algorithm
  XtNameToWidget() returns the descendant with the shortest name that matches the specification according to the following rules (where child
  is either a popup child or a normal child if the widget is a subclass of Composite):

  o  Enumerate the object subtree rooted at reference widget in breadth-first order, qualifying the name of each object with the names of all
     its ancestors up to but not including reference.  The ordering between children of a common parent is not defined.

  o  Return  the  first  object in the enumeration that matches the specified names, where each component of names matches exactly the corre-
     sponding component of the qualified object name and an asterisk matches any series of components, including none.

  o  If no match is found, return NULL.

  Since breadth-first traversal is specified, the descendant with the shortest matching name (i.e., the fewest number of components), if any,
  will always be returned.  However, since the order of enumeration of children is undefined and since the Intrinsics do not require that all
  children of a widget have unique names, XtNameToWidget() may return any child that matches if there are multiple  objects  in  the  subtree
  with	the same name(s).  Consecutive separators (periods or asterisks) that contain at least one asterisk are treated as a single asterisk.
  Consecutive periods are treated as a single period.

See Also
  XtCreateWidget(1), XtName(1).

Xt - Object Information 													  XtNameToWidget()
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy