Sponsored Content
Full Discussion: Condition check using awk
Top Forums UNIX for Dummies Questions & Answers Condition check using awk Post 302754455 by RudiC on Thursday 10th of January 2013 03:33:51 PM
Old 01-10-2013
Here you go:
Code:
$ provider=PROVIDER
$ awk -v srch="$search" -v repl="$replace" -vprov=$provider\
    'BEGIN {FS="\"\|\"";OFS="\"|\""}
     {$8=($8~"^"srch)?repl:prov}
     1
    '  file
"SYLVESTER,WILLARD G"|"S00633600"|"221052958A"|"H2256"|"015"|""|"00000042BASJ"|"PROVIDER"|"N" . . .
"PURINGTON-KELLEY,C"|"S00808783"|"029424717A"|"H2256"|"024"|"MEMBER JOINED ANOTHER MEDICARE RISK PLAN"|"00000049BAQS"|"MEMBER"|"Y". . .

P.S.: small addition to vgersh99's proposal: "))}1 --- ") qq)}1>
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with shell script to check the condition.

:) Hi, I want to script for this scenerio, OSR Settings Scenario : We are looking to find all the *.a files from the following locations in the filesystem of a server. OSR Directories /etc /bin /usr/bin /usr/sbin /var/adm These *.a files should have the permissions on... (12 Replies)
Discussion started by: sakthilinux
12 Replies

2. Shell Programming and Scripting

WHILE LOOP CONDITION CHECK

Hello I want to compare values of two variables as CHECK condition in a while loop. eg: var1=0 var2=10 while do echo " $var1 " var1=`expr $var1 + 1` done However this is giving error.How to do it in a proper manner? Thanks. (3 Replies)
Discussion started by: dashing201
3 Replies

3. Shell Programming and Scripting

Check condition inside the loop

Hi, I am in trouble. I can get inside my condition test inside a loop : I am in ksh (solaris) while read file do <commande to retrieve file> >> ${LOG_RETRIEVE_FILE.log} msg_err=$(cat ${LOG_RETRIEVE_FILE.log} | grep "error retrieve") if ; then <sendmail> exit 1 fi done I tried... (6 Replies)
Discussion started by: Aswex
6 Replies

4. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

5. Shell Programming and Scripting

sed to check two condition need solution

Hi, I am having a file in below format server-1 Win2008:server-1-1700,1774,290104720,290104987:server-1 server-2 AIX:server-2-:server-2 server-2 I want the output like this Win2008:server-1-1700,1774,290104720,290104987:standalon-server AIX:server-2-:VIO-Sever I used the... (7 Replies)
Discussion started by: ranjancom2000
7 Replies

6. Shell Programming and Scripting

if condition to check the hostname (unix)

I want to know the if condition in checking the hostname in unix and then running a cron job (all in a single line) Thanks (2 Replies)
Discussion started by: prash358
2 Replies

7. Shell Programming and Scripting

Check the value in xml based on condition

Hi, I have a log file having n number of xml's like the one below. <uOStatus xmlns:env="http://abc.org/def/ghi/"... (3 Replies)
Discussion started by: Neethu
3 Replies

8. Shell Programming and Scripting

Need to check a condition using SFTP command

HI, I connected to a remote FTP server using sftp command. Need to check if any files are present inside a folder in server directory and then remove if present. The code should look like this How can this condition be written. Thanks in advance, (2 Replies)
Discussion started by: confused_info
2 Replies

9. Shell Programming and Scripting

Check two condition in while loop

Hi, I Have to check two condition in while loop every 2 minutes. while loop is accompanied with number of times it will check.Please help in putting the two condition in while loop as appropriate. z= input value, A=1 while do 1.check the file output,if the file output is N then keep on... (2 Replies)
Discussion started by: netdbaind
2 Replies
SHOREWALL-RTRULES(5)						  [FIXME: manual]					      SHOREWALL-RTRULES(5)

NAME
rtrules - Shorewall Routing Rules file SYNOPSIS
/etc/shorewall/rtrules DESCRIPTION
Entries in this file cause traffic to be routed to one of the providers listed in shorewall-providers[1](5). The columns in the file are as follows. SOURCE (Optional) - {-|[&]interface|address|interface:address} An ip address (network or host) that matches the source IP address in a packet. May also be specified as an interface name optionally followed by ":" and an address. If the device lo is specified, the packet must originate from the firewall itself. Beginning with Shorewall 4.5.0, you may specify &interface in this column to indicate that the source is the primary IP address of the named interface. DEST (Optional) - {-|address} An ip address (network or host) that matches the destination IP address in a packet. If you choose to omit either SOURCE or DEST, place "-" in that column. Note that you may not omit both SOURCE and DEST. PROVIDER - {provider-name|provider-number|main} The provider to route the traffic through. May be expressed either as the provider name or the provider number. May also be main or 254 for the main routing table. This can be used in combination with VPN tunnels, see example 2 below. PRIORITY - priority The rule's numeric priority which determines the order in which the rules are processed. Rules with equal priority are applied in the order in which they appear in the file. 1000-1999 Before Shorewall-generated 'MARK' rules 11000-11999 After 'MARK' rules but before Shorewall-generated rules for ISP interfaces. 26000-26999 After ISP interface rules but before 'default' rule. MARK - {-|mark[/mask]} Optional -- added in Shorewall 4.4.25. For this rule to be applied to a packet, the packet's mark value must match the mark when logically anded with the mask. If a mask is not supplied, Shorewall supplies a suitable provider mask. EXAMPLES
Example 1: You want all traffic coming in on eth1 to be routed to the ISP1 provider. #SOURCE DEST PROVIDER PRIORITY MASK eth1 - ISP1 1000 Example 2: You use OpenVPN (routed setup /tunX) in combination with multiple providers. In this case you have to set up a rule to ensure that the OpenVPN traffic is routed back through the tunX interface(s) rather than through any of the providers. 10.8.0.0/24 is the subnet chosen in your OpenVPN configuration (server 10.8.0.0 255.255.255.0). #SOURCE DEST PROVIDER PRIORITY MASK - 10.8.0.0/24 main 1000 FILES
/etc/shorewall/rtrules SEE ALSO
http://shorewall.net/MultiISP.html http://shorewall.net/configuration_file_basics.htm#Pairs shorewall(8), shorewall-accounting(5), shorewall-actions(5), shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5), shorewall-params(5), shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5), shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5) NOTES
1. shorewall-providers http://www.shorewall.net/manpages/shorewall-providers.html [FIXME: source] 06/28/2012 SHOREWALL-RTRULES(5)
All times are GMT -4. The time now is 01:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy