Sponsored Content
Top Forums Shell Programming and Scripting awk - multiple and nested if-then-else Post 303038733 by RudiC on Thursday 12th of September 2019 11:34:53 AM
Old 09-12-2019
Quote:
Originally Posted by jcdole
... What I would like to do if possible is ( don't take care about the {} syntax; it is just to explain my thought) :
.
.
.

To explain what i want I am going to use pseudo code so forget missing ';' or missing {} :

That's EXACTLY the point - you CAN'T "forget missing ... {}". You HAVE to "take care about the {} syntax" as they support / convey the logics. action n in an if construct is a - one or multiple statement - block of code to be executed if the relevant condition is true. Inside the block, you can have other constructs, whatever the programming language provides.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nested Loop to Echo Multiple Arrays

I have three arrays which hold three elements each. I have a fourth array which contains the names of those three arrays. I'm having difficulty creating a nested loop that can loop through each array and echo their values. script #!/bin/ksh # array of locations (usa, london, australia)... (1 Reply)
Discussion started by: yongho
1 Replies

2. Shell Programming and Scripting

awk 2 delimiter nested

Hello All, This work could be very easy for you guys. I would really appreciate help. input file: output file: (Desired) What I am capable of doing: Command: cat inputfile | awk -F\| '{print "num="$1" value="$2" digits="$3" name1="$4" file="$5" code="$6}' > outputfile Result what I am... (5 Replies)
Discussion started by: onlyroshni
5 Replies

3. UNIX for Advanced & Expert Users

sed in awk ? or nested awk ?

Hey all, Can I put sed command inside the awk action ?? If not then can i do grep in the awk action ?? For ex: awk '$1=="174" { ppid=($2) ; sed -n '/$ppid/p' tempfind.txt ; }' tempfind.txt Assume: 174 is string. Assume: tempfind.txt is used for awk and sed both. tempfind.txt... (11 Replies)
Discussion started by: varungupta
11 Replies

4. UNIX for Dummies Questions & Answers

Nested if with multiple conditions

Deal Experts I am working on a script to find a date which is 7 days older and follwoing is my approach #!/bin/sh Yr=`date +"%Y"` Mn=`date +"%m"` Md=28 Da=`date +"%d"` echo $Yr echo $Mn echo $Da var1=$Yr$Mn$Da echo "before" $var1 if expr $Da > 7 then Da=`expr $Da - 7`... (3 Replies)
Discussion started by: sweetnsourabh
3 Replies

5. 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

6. Shell Programming and Scripting

Help with nested $s and quotations in bash / awk

Folks - newbie bash coder here and I'd like to get your help to make the code below work. As you can see, I was trying to count the total number of lines with the 3rd value >= 15 in a file and wanted to make the threshold "15" configurable, but apparently the $THRESHOLD value was not populated... (3 Replies)
Discussion started by: bashzipper
3 Replies

7. Shell Programming and Scripting

Nested awk Statements

Hello again everyone, yes, I'm back again for more help! So I'm attempting to read two separate files and generate some XML code from that. My current code is: BEGIN { print "<?xml version=\"1.0\" encoding=\"utf-8\">" print "<Export>" } { x=1; print "<section name=\"Query" NR "\">"... (5 Replies)
Discussion started by: Parrakarry
5 Replies

8. Shell Programming and Scripting

Using shell command need to parse multiple nested tag value of a XML file

I have this XML file - <gp> <mms>1110012</mms> <tg>988</tg> <mm>LongTime</mm> <lv> <lkid>StartEle=ONE, Desti = Motion</lkid> <kk>12</kk> </lv> <lv> <lkid>StartEle=ONE, Source = Velocity</lkid> <kk>2</kk> </lv> <lv> ... (3 Replies)
Discussion started by: NeedASolution
3 Replies

9. Shell Programming and Scripting

awk nested looping?

I am trying to parse a text file and send its output to another file but I am having trouble conceptualizing how I am supposed to do this in awk. The text file has a organization like so: Name Date Status Location (city, state, zip fields) Where each of these is on a separate line in... (1 Reply)
Discussion started by: kellyanneghj
1 Replies
DH_MISSING(1)							     Debhelper							     DH_MISSING(1)

NAME
dh_missing - check for missing files SYNOPSIS
dh_missing [-Xitem] [--sourcedir=dir] [debhelperoptions] DESCRIPTION
dh_missing compares the list of installed files with the files in the source directory. If any of the files (and symlinks) in the source directory were not installed to somewhere, it will warn on stderr about that (--list-missing) or fail (--fail-missing). Please note that without either of these options, dh_missing will silently do nothing. This may be useful if you have a large package and want to make sure that you don't miss installing newly added files in new upstream releases. Remember to test different kinds of builds (dpkg-buildpackage -A/-B/...) as you may experience varying results when only a subset of the packages are built. FILES
debian/not-installed List the files that are deliberately not installed in any binary package. Paths listed in this file are ignored by dh_missing. However, it is not a method to exclude files from being installed by any of the debhelper tool. If you want a tool to not install a given file, please use its --exclude option (where available). dh_missing will expand wildcards in this file (since debhelper 11.1). Wildcards without matches will be ignored. OPTIONS
--list-missing Warn on stderr about source files not installed to somewhere. Note that files that are excluded from being moved via the -X option are not warned about. This is the default in compat 12 and later. --fail-missing This option is like --list-missing, except if a file was missed, it will not only list the missing files, but also fail with a nonzero exit code. SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Michael Stapelberg <stapelberg@debian.org> 11.1.6ubuntu2 2018-05-10 DH_MISSING(1)
All times are GMT -4. The time now is 05:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy