Sponsored Content
Full Discussion: case command inside awk/nawk
Top Forums Shell Programming and Scripting case command inside awk/nawk Post 302150984 by vgersh99 on Thursday 13th of December 2007 08:25:18 AM
Old 12-13-2007
no, there's not. but you can emulate it.
gawk 3.1.3+ does support switch/case though.

Last edited by vgersh99; 12-13-2007 at 09:44 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to access values of awk/nawk variables outside the awk/nawk block?

i'm new to shell scripting and have a problem please help me in the script i have a nawk block which has a variable count nawk{ . . . count=count+1 print count } now i want to access the value of the count variable outside the awk block,like.. s=`expr count / m` (m is... (5 Replies)
Discussion started by: saniya
5 Replies

2. Shell Programming and Scripting

How to specify 'not case sensitive' in regex (nawk, sed, patern expencions)?

Is it possible to make the search in regular exprecion or in matching parts of sed, nawk and others to IGNORE the case of the search string? I mean, like if used 'grep' with -i option: > grep -i "abc" file I would like to be able to do the same, say, by nawk: > nawk '/abc/ {print $0}'... (4 Replies)
Discussion started by: alex_5161
4 Replies

3. Shell Programming and Scripting

using cp command inside nawk

Hello I have facing issue while using cp command inside nawk block. #!/bin/ksh my_name=$1 nawk -v my_name1=$my_name 'BEGIN { n = split(my_name1,names,":"); for (i=1;i<=n;i++) { print names; cpcmd = "cp " /tmp/test.txt" " ./sample system(cpcmd) } exit }' exit 0 i'am getting... (1 Reply)
Discussion started by: piscean_n
1 Replies

4. Shell Programming and Scripting

How to use same variable value inside as well as outside of the awk command?

Hi Jim, The following script is in working state. But i m having one more problem with awk cmd. Could you tell me how to use any variable inside awk or how to take any variable value outside awk. My problem is i want to maintain one property file in which i am declaring variable value into that... (12 Replies)
Discussion started by: Ganesh Khandare
12 Replies

5. Shell Programming and Scripting

problem in nawk : case insensitive pattern matching

HI, My file contains data something like 034500,5,B5004946544EB185,DEFAULT,0 Now i want to do a pettern match for DEFAULT and remove that particular line from file and transfer the rest contents to temp file.But my req is i want to do case insensitive matching ie DEFAULT / default. I... (4 Replies)
Discussion started by: centurion_13
4 Replies

6. Shell Programming and Scripting

Reading input record from inside nawk

Hi friends, I have small query with reg to awk search pattern.. below is my sample file and code which i tried.. $ cat file.txt xxx,yyyyy,messageID,sha xxxx,errorcode,messageID,name in the above sample file - let assume I know the errorcode(2nd record) using which I want to... (2 Replies)
Discussion started by: Shahul
2 Replies

7. Shell Programming and Scripting

Nested case inside awk

please let me know if the below code could be written efficiently inside single awk case "$INP" in ksh) cat catalog | awk 'BEGIN {FS=",";} { print $2 } END {}' ;; pset) cat catalog | awk 'BEGIN {FS=",";} { print $3 } END {}' ;; dml) cat catalog | awk 'BEGIN {FS=",";} {... (2 Replies)
Discussion started by: cvsanthosh
2 Replies

8. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

9. Shell Programming and Scripting

Substitute variable inside nawk

Hi, I need to set "prd" in the below command to a unix variable nawk '/^#/ {next} FNR==NR {prd;next} !($0 in prd)' So, this is what i did fname=prd // unix shell variable nawk -v fname=$fname '/^#/ {next} FNR==NR {fname;next} !($0 in fname)'But the value of fname i.e "prd" is not... (8 Replies)
Discussion started by: mohtashims
8 Replies

10. UNIX for Beginners Questions & Answers

How to avoid arguments inside Nawk command?

Hi, Here is my command print $2 was meant to select the second column however, it is getting substituted with the second argument that was passed to the script. Can you please tell me how can I resolve this ? (6 Replies)
Discussion started by: mohtashims
6 Replies
DOCBOOK2GJOTS(1)					      General Commands Manual						  DOCBOOK2GJOTS(1)

NAME
docbook2gjots - Convert a DOCBOOK file to gjots format (on stdout) SYNOPSIS
docbook2gjots [ DOCBOOK-file ] DESCRIPTION
docbook2gjots converts a DOCBOOK XML file into gjots format. docbook2gjots uses gawk(1) to perform the conversion. <preface>, <chapter>, <section>, <sect1>, <sect2>, <sect3> and <sect4> tags are used to define NewEntry and NewFolder boundaries. They should definitely have <title> tags. This is a quick and dirty hack using gawk(1) and does no formal checking of XML or SGML syntax nor does it validate against the DOCBOOK DTD. Consequently, if the syntax of the file is broken the conversion will probably fail. It is intended that a round-trip can be made so that gjots(1) can be used as a tool at all stages of DOCBOOK production - mainly as an out- line processor to help the author organise and order the work. A document may well start its life in gjots(1) as the initial thoughts are marshalled. As the document forms up, it can be converted to DOCBOOK with the following command which automatically adds tags such as <?xml...>, <para> etc: gjots2docbook -b file.gjots >file.xml docbook2pdf file.xml Or, starting with an existing DOCBOOK file: docbook2gjots file.xml >file.gjots In the latter case, the document will already have a lot of DOCBOOK tags so to convert back to docbook, add the -e and -p options: gjots2docbook -b -p -e file.gjots >file.xml docbook2pdf file.xml AUTHOR
Written by Bob Hepple <bhepple@freeshell.org> http://bhepple.freeshell.org/gjots COPYRIGHT
Copyright (c) 2002 Robert Hepple This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PAR- TICULAR PURPOSE. SEE ALSO
gjots(1), gjots2html(1), gjots2docbook(1) DOCBOOK2GJOTS(1)
All times are GMT -4. The time now is 03:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy