Sponsored Content
Full Discussion: Nested case inside awk
Top Forums Shell Programming and Scripting Nested case inside awk Post 302631209 by cvsanthosh on Friday 27th of April 2012 04:32:00 AM
Old 04-27-2012
Nested case inside awk

please let me know if the below code could be written efficiently inside single awk
Code:
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=",";}     { print $4 }  END {}' 
;;
esac


Last edited by Franklin52; 04-27-2012 at 05:39 AM.. Reason: Please use code tags for code and data samples
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

case command inside awk/nawk

well I found lot of topics about awk..about if command in awk.. but I had to implement this: nawk -F"|" ' $47 ~ /0R0011/ { print > ("/home/user/M/MC.tmp" )} $47 ~ /0R0012/ { print > ("/home/user/M/DuSI.tmp" )} $47 ~ /0R0014/ { print > ("/home/user/M/FF.tmp" )} $47 ~ /0R0018/ { print >... (9 Replies)
Discussion started by: abdulaziz
9 Replies

2. Shell Programming and Scripting

Nested Case in UNIX script

Hi I wanted to know if we can write a nested case in UNIX script. Something like following - Case ${sDB} in Srvr1) case ${sSchema} Sch1) DBusr=Username1 DBPwd=Pwd1 ;; Sch2) DBusr=Username2 ... (1 Reply)
Discussion started by: sumeet
1 Replies

3. Shell Programming and Scripting

Case inside case?

Im new to unix and shell scripting. I am required to write a program and im in the process of creating a menu system. I have my main menu but i want to be able to select an option that takes me onto another menu. I have tried doing this with the case statement with no luck so far. Wondering if it... (3 Replies)
Discussion started by: RAFC_99
3 Replies

4. Shell Programming and Scripting

nested double quota and white space inside variable

I have a question about nested double quotes. Any help is appreciated. Here are my commands on Mac OS. # string="Ethernet \"USB Ethernet\" \"Bluetooth DUN\" AirPort FireWire \"Bluetooth PAN\"" # echo $string Ethernet "USB Ethernet" "Bluetooth DUN" AirPort FireWire "Bluetooth PAN" #... (3 Replies)
Discussion started by: lindazhou
3 Replies

5. Shell Programming and Scripting

If-statement nested in case

I'm trying to write case statements with 'if statements' embedded inside of them. I'm using the korn shell but it's not functioning. If I want to see if a string exists in a file and then perform an action, what would be the best way to do this? For file "asg51fin" to delete a line if a... (1 Reply)
Discussion started by: dazeman27
1 Replies

6. Red Hat

Repacking a file inside a java archive with nested .jars

Hello, I need to repack a file inside several java archives (nested .jar files) with or without overwrite. I am using a manual approach with mc, but it's painfully slow progress. For example I want to refresh a file deep inside a java archive (with nested .jar files): I have a java... (0 Replies)
Discussion started by: Laurentiu
0 Replies

7. Shell Programming and Scripting

Nested case

Hi there, I have nested case in my script. I am asking user, want to continue? if user press y/Y then my inner case should continue, rather than that my code start from beginning. I would like to continue my inner case until user press n or N. Is any one tell me how can I do? Thanking You,... (2 Replies)
Discussion started by: kasparov
2 Replies

8. Shell Programming and Scripting

Error with nested if within an sqlplus task inside

Hi ALL, I am receving a "strange" error using a nested if within an sql operation inside: ./dom.ksh: syntax error at line 80 : `then' unmatched This is all my script code: in bold the step receiving the error. Any help would really aprrecieted ......! **** I have tried all the... (2 Replies)
Discussion started by: AndreaCecco
2 Replies

9. Shell Programming and Scripting

Nested case: rsync command not found

Hello! Below my first bash script. As you can see i build 2 nested cases. The second one (sync databases) is working fine. Bu the first one (sync datadirs) is not working. It says: rsync: command not found. However when i move the rsync command to the top of the script its working. So i suppose... (2 Replies)
Discussion started by: hyperconnected
2 Replies

10. UNIX for Beginners Questions & Answers

Case inside While read File

Hi Experts, Need your guidance for case statement. I tried many way but no success yet.Now my existing code is doing something like below. Each Line of the input file contains one test case.#!/bin/bash FILE=$1 while read LINE; do do COMMAND done < $FILE Now I want to modify the code... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies
dspcat(1)						      General Commands Manual							 dspcat(1)

NAME
dspcat - Displays all or part of a message catalog SYNOPSIS
dspcat [-g] catalog_name [set_number[message_number]] OPTIONS
Formats the output so that it can be used as input to the gencat command. You cannot use the message_number argument with the -g option. OPERANDS
Specifies a file containing a message catalog. If the file is not in the current directory, dspcat searches for it in the set of directo- ries specified by the NLSPATH environment variable. (For more information about NLSPATH, see catopen(3).) Specifies a set in the catalog. Specifies a particular number in the specified set. DESCRIPTION
The dspcat command, part of the Tru64 UNIX Message Facility, displays a particular message, all of the messages in a set, or all of the messages in a catalog. If you include all three command operands, dspcat displays a particular message. If you do not include message_number, all the messages in the specified set are displayed. If you specify only catalog_name, all the messages in the catalog are displayed. If you specify either an invalid message_number or invalid set_number, an error message is displayed. You must include set_number if you include message_number. EXAMPLES
To display message number 2 in set number 1 of test.cat, enter: dspcat test.cat 1 2 SEE ALSO
Commands: dspmsg(1), gencat(1), mkcatdefs(1) Functions: catclose(3), catgets(3), catopen(3) dspcat(1)
All times are GMT -4. The time now is 10:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy