Sponsored Content
Full Discussion: replacement
Top Forums UNIX for Dummies Questions & Answers replacement Post 302518353 by ctsgnb on Friday 29th of April 2011 11:26:48 AM
Old 04-29-2011
what do you mean by "=> 920000" ???

1) "is greater than or equal 920000" ?

2) "the second field contains the pattern '920000' " ?

Please post a representative example of input and expected output


Code:
# cat tst
2079951061790                       SCK0000891539000000000000021600R
2079951061790                       SCK0000901487000000000000028900R
2079951061790                       SCK0000903092000000000000021300R

2079951074758                       SCK0000420674000000000000124500R
2079951074758                       SCK0000420367000000000000014610R
2079951074758                       SCK0000421367000000000000014610R

Code:
# awk '$1==2079951061790&&$2~/920000/{sub("SCK","LCK",$2)}1' tst
2079951061790                       SCK0000891539000000000000021600R
2079951061790                       SCK0000901487000000000000028900R
2079951061790 LCK0000903092000000000000021300R

2079951074758                       SCK0000420674000000000000124500R
2079951074758                       SCK0000420367000000000000014610R
2079951074758                       SCK0000421367000000000000014610R

Code:
# awk '$1==2079951061790&&$2~/920000/{sub("SCK","LCK",$0)}1' tst
2079951061790                       SCK0000891539000000000000021600R
2079951061790                       SCK0000901487000000000000028900R
2079951061790                       LCK0000903092000000000000021300R

2079951074758                       SCK0000420674000000000000124500R
2079951074758                       SCK0000420367000000000000014610R
2079951074758                       SCK0000421367000000000000014610R

Code:
# a=2079951061790
# b=920000
# awk -v x="$a" -v y="$b" '$1==x&&$2~y{sub("SCK","LCK",$0)}1' tst
2079951061790                       SCK0000891539000000000000021600R
2079951061790                       SCK0000901487000000000000028900R
2079951061790                       LCK0000903092000000000000021300R

2079951074758                       SCK0000420674000000000000124500R
2079951074758                       SCK0000420367000000000000014610R
2079951074758                       SCK0000421367000000000000014610R

?

Last edited by ctsgnb; 04-29-2011 at 12:56 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Regarding Replacement

I have two files: file1: somedata <html> <head> This is sample statement ...... ...... </head> </html> somedata file2: olga 81 91 B A rene 82 92 B A zack 83 93 Expextd Result: (2 Replies)
Discussion started by: rajx
2 Replies

2. Shell Programming and Scripting

Character replacement

Hi, I am working on a command that replaces some occurrences of quotation marks in file. The quotation mark cannot be the first or the last character in line and cannot be preceded or followed by a comma. I am not an expert in regular expressions, but I managed to create the following... (2 Replies)
Discussion started by: piooooter
2 Replies

3. Shell Programming and Scripting

Need Replacement for sed

Hi Can anyone provide me the replacement of sed with xargs perl syntax for the below sed -e :a -e '/;$/!N;s/\n//; ta' -e 's/;$//' This should be without looping has to take minimal time for search (0 Replies)
Discussion started by: dbsurf
0 Replies

4. UNIX for Advanced & Expert Users

getprotobyname replacement?

I've been tasked with converting our software from strictly an IPv4 environment to handling both IPv4 and IPv6. I'm very nearly done and everything seems to be progressing just fine. There's just one thing that's been nagging me for a while now, so I thought I'd enquire about this. I've read... (1 Reply)
Discussion started by: sszd
1 Replies

5. UNIX for Dummies Questions & Answers

Pattern Replacement

There is a requirement that i need to replaced a pattern by another pattern in all the files in my entire file system. there are 1000s of file in the system. let the pattern is "calcuta". i have to replace this pattern by "kolkata" in all those files which contain "calcuta". I am only able to... (12 Replies)
Discussion started by: palash2k
12 Replies

6. Shell Programming and Scripting

String replacement

Hi All, I have below file which has data in below format. #$ | AB_100 | AB_300 ()| AB_4 @*(% | AB-789 i want o/p as below format. | AB_100 | AB_300 | AB_4 | AB-789 So here there is no standard format. How we can achieve the same in unix ? Regards, (3 Replies)
Discussion started by: gander_ss
3 Replies

7. Shell Programming and Scripting

SED replacement

Hi, i have a file with lines, file.txt ------- test is fun testing is better I need to replace 'test' to 'develop' and i used, a=test b=develop sed "s,$a,$b,g" -------- but i see the word 'testing' is also replaced. Need some solution. Is there any way i could replace only 'test' ? (4 Replies)
Discussion started by: giri_luck
4 Replies

8. Shell Programming and Scripting

help me :replacement

Hi pls help me for below; i have a file .content is : =================== uid,pcsPricingPlan,refPcsQosProfName 821910002022,smartlimit,SGSNQOS1 i have to replace the value of uid and pricingplan by a unix script. may be the value would be next line or any where in the file. pls... (9 Replies)
Discussion started by: Aditya.Gurgaon
9 Replies

9. HP-UX

Terminal replacement

I recently picked up an HP9000 server running HPUX. I would like to replace the CRT terminal console with something I can use a flat panel monitor. Any suggestions would be greatly appreciated. (1 Reply)
Discussion started by: Stevebei
1 Replies

10. Solaris

Is this MB, which needs replacement ?

Hello, I am getting below error in fmadm output. This server is not in support, so can't reach them. Is it showing that motherboard is faulty and should be replaced ? It was rebooted a week back and then, there were no errors # fmadm faulty --------------- ------------------------------------ ... (1 Reply)
Discussion started by: solaris_1977
1 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. --font=desc Set the font description. Default is Monospace 12. --rtl Do rtl layout. --paper ps Choose paper size. Known paper sizes are legal, letter, a4. Default is A4. --bottom-margin=bm Set bottom margin in postscript points (1/72 inch). Default is 36. --top-margin=tm Set top margin. Default is 36. --left-margin=lm Set left margin. Default is 36. --right-margin=rm Set right margin. Default is 36. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --encoding=ENCODING Assume the documentation encoding is ENCODING. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 06:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy