Sponsored Content
Full Discussion: Replace with condition
Top Forums UNIX for Dummies Questions & Answers Replace with condition Post 302808613 by vidyadhar85 on Friday 17th of May 2013 04:37:45 AM
Old 05-17-2013
try
Code:
 
awk -F, '!$9{$9=0}{OFS=","}1' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to replace numbers on lines according to condition on the same line

hello everyone my file contains many records, the following is a sample: BEGIN ASX1500000050002010120000000308450201012000177 ASX1100002000000201012000000038450201012000220 ASX1600100005000201012000000038450020101200177 ASX1900100006000201067000000058450020101200177... (2 Replies)
Discussion started by: neemoze
2 Replies

2. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

3. Shell Programming and Scripting

Replace text inside XML file based on condition

Hi All, I want to change the name as SEQ_13 ie., <Property Name="Name">SEQ_13</Property> when the Stage Type is PxSequentialFile ie., <Property Name="StageType">PxSequentialFile</Property> :wall: Input.XML <Main> <Record Identifier="V0S13" Type="CustomStage" Readonly="0">... (3 Replies)
Discussion started by: kmsekhar
3 Replies

4. Shell Programming and Scripting

Find a line using a condition and replace a string in that line

Hello, I have a 100 line code. I have given a sample of it below: ABC*654654*1*54.54*21.2*87*1*654654654654 CCC*FS*FS*SFD*DSF GGG*FGH*CGB*FBDFG*FGDG ABC*654654*1*57.84*45.4*88*2*6546546545 CCC*WSF*SG*FGH*GHJ ADA*AF*SFG*DFGH*FGH*FGTH I need to select the line starting with "ABC" its... (6 Replies)
Discussion started by: nithins007
6 Replies

5. Emergency UNIX and Linux Support

Find a line using a condition and replace a string in that line

Hello, I have a 100 line code. I have given a sample of it below: ABC*654654*1*54.54*21.2*87*1*654654654654 CCC*FS*FS*SFD*DSF GGG*FGH*CGB*FBDFG*FGDG ABC*654654*1*57.84*45.4*88*2*6546546545 CCC*WSF*SG*FGH*GHJ ADA*AF*SFG*DFGH*FGH*FGTH I need to select the line starting with "ABC" its... (3 Replies)
Discussion started by: nithins007
3 Replies

6. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

7. Shell Programming and Scripting

Replace Char in XML Base on Condition

HI All Here is my Input file A. I want to add extra char in the line base on below condition. 1> if Below second line is <xn:vsDataType>vsDataEUtranCellFDD</xn:vsDataType> then <xn:VsDataContainer id= will be <xn:VsDataContainer_id_1= 2 > if Below second line is... (4 Replies)
Discussion started by: asavaliya
4 Replies

8. Shell Programming and Scripting

awk to replace a specific field in certain condition

Hi, I have a file like below PRUM,67016800 ,CC ,C1,67016800 , ,Y,Y,2 ,CK,BX,FOX ,00000001,EA,00000001,20141120 00:00:00, ,N,Y,Y,CK ABCDEF... (7 Replies)
Discussion started by: mady135
7 Replies

9. UNIX for Beginners Questions & Answers

awk replace cells with NaN/delete if condition

Hello, I will like to delete/replace $3 with NaN. condition $3>-2000 (file1.dat) to produce out.dat. I want to retain the structure of the table. I use this code, this output only $3. Any idea on how to modify this code. Thank you. awk -v OFS='' '{for(i=1; i<=NF; i++) if ($i > -2000 || $i ==" >... (4 Replies)
Discussion started by: geomarine
4 Replies

10. Shell Programming and Scripting

Find a text and if condition matches then replace it

Need a script that can find text in a file and replace it accordingly. This is the file I have: while IFS=',' read -r f1 f2 f3 do { nohup /home/testuser/dbmaintenance/sys_offline_maintenance.sh $f1 $f2 $f3 > $f2.out & } done < "/home/testuser/dbmaintenance/week1offlineserver.txt" In... (4 Replies)
Discussion started by: singhhe
4 Replies
libprinterconf(6)						   Games Manual 						 libprinterconf(6)

NAME
pconf_detect - A command-line utility for autodetecting printers in Linux SYNOPSIS
pconf_detect -m [PPORT|NETWORK] -i <info-string> DESCRIPTION
pconf_detect is a command-line utility for autodetecting printers from Linux. It is a simple wrapper around libprinterconf's pconf_detect_printer() function. It currently supports two methods of autodetection: parallel port detection and network detection. The detection type is specified with the -m option, which can be followed by one of two values: PPORT or NETWORK. Detection specific information is passed following the -i option. For parallel port detection, this will be a comma-separated string of parallel port numbers. For network detection, it will be some method of specifying a range of hosts or IP addresses. The most common form is "10.203.1.2/24", indicating the IP/bitmask to scan. Other formats include an IP range ("10.203.1.12-30"), an IP/netmask ("10.203.1.2/255.255.255.0"), a simple IP address ("10.203.1.2"), or a host name ("myprinter.mydomain.com"). [Note: Detection of large network subnets can take a significant amount of time.] pconf_detect will print out a set of formatted text strings, one for each detected printer. The actual format of these strings will depend on the detection method. For parallel port detection, the string will be in the basic form: "port=p;model=m". For a network printer the form is: "printer=hostaddr;vendor=v;model=m". EXAMPLES
PPORT example: pconf_detect -m PPORT -i 0,1 where "0,1" is a comma-separated list of the parallel port to scan. NETWORK example: pconf_detect -m NETWORK -i "10.203.1.2/24" where "10.203.1.2/24" is the IP/bitmask to scan. SEE ALSO
libprinterconf(3) Printerconf Docs 12 April 2000 libprinterconf(6)
All times are GMT -4. The time now is 03:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy