Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find and Replace random numeric value with non-numeric value Post 302446496 by agama on Wednesday 18th of August 2010 11:46:06 PM
Old 08-19-2010
Quote:
Originally Posted by Bahf1s
[SIZE=1]

but the first column number above in red, is different for every row, the 7 numbers that follow 170 are random numbers for each row. So do i still echo that string?
No, I think that rdcwayx was giving an example of how you might go about it using the echo as a sample for testing.

I think this is the most straight forward way:

Code:
sed 's/^[^,]*/aaaaaaaaaa/' input-file-name >output-file

This will match everything from the beginning of the line to the first comma (the 10 digit number) and replace it with 'aaaaaaaaaa' You can replace the string of a's with what ever you need.
This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace spaces with 0's having numeric values.

What could be the regular expression with gsub function in awk to replace all numerics having spaces before to be replaced with 0s? (1 Reply)
Discussion started by: videsh77
1 Replies

2. Shell Programming and Scripting

Perl code to differentiate numeric and non-numeric input

Hi All, Is there any code in Perl which can differentiate between numeric and non-numeric input? (11 Replies)
Discussion started by: Raynon
11 Replies

3. Shell Programming and Scripting

Numeric or not

Is there a simple way of determining whether a command line arguement is numeric or not?? I tried a search and didn't find anything similar... This is the 2nd time I've made this post.... It didn't appear that the first one showed up ?? Sorry if this is a duplicate... (1 Reply)
Discussion started by: harrisjl
1 Replies

4. Shell Programming and Scripting

Numeric or not?

Is there an easy way using a command or other routine for testing whether an argument on the command line is numeric? Just want to validate... I ran a search and didn't find a similar question.... Thx (3 Replies)
Discussion started by: harrisjl
3 Replies

5. Shell Programming and Scripting

Replace variable length numeric string

I have a customer who logged some cc and bank account numbers in their apache logs. I got the cc numbers x'd out with sed -e 's/args=\{16\}/args=XXXXXXXXXXXXXXXX/g' -e 's/cardnum=\{16\}/cardnum=XXXXXXXXXXXXXXXX/g'but that wasn't too difficult due to the value being 16 digits. The bank account... (7 Replies)
Discussion started by: mk4mzid
7 Replies

6. UNIX for Dummies Questions & Answers

SED command to search for numeric and replace

Hi I am very new to linux and scripting. I need to replace numbers abc with number xyz inputting from a reference file. I used the following command - sed "s/$grd/$lab/" , where $grd and $lab comes from reference file. The problem is the above line doesnt take care of space..... (1 Reply)
Discussion started by: ajayh
1 Replies

7. Shell Programming and Scripting

find numeric duplicates from 300 million lines....

these are numeric ids.. 222932017099186177 222932014385467392 222932017371820032 222932017409556480 I have text file having 300 millions of line as shown above. I want to find duplicates from this file. Please suggest the quicker way.. sort | uniq -d will... (3 Replies)
Discussion started by: pamu
3 Replies

8. Shell Programming and Scripting

Find the numeric value in a string and then check the max. value

hi, i have a string " 00000069 ThreadMonitor W WSVR0606W: Thread "WebContainer : 43|null" (00000069) was previously rep orted to be hung but has completed. It was active for approximately 47533430 milliseconds. There is/are 43 thread(s) in tot al in the server that still may be hung." ... (4 Replies)
Discussion started by: lovelysethii
4 Replies

9. Shell Programming and Scripting

UNIX-how to find out the numeric value

Hi All, I need to found the below numeric value using unix(shell) commands in .txt file and its available in root directory. for example: file name is siva.txt and content is Siva_12345_werwerwe,11,22,33 Siva_12346_werwerwe,22,33,44 Siva_12347_werwerwe,55,44,66 for above string i... (2 Replies)
Discussion started by: sivaraman1981
2 Replies

10. UNIX for Beginners Questions & Answers

Replace a numeric values in a certain column

Hi All, I am trying to replace a certain value from one place in a file . In the below file at position 35 I will have 8 I need to modify all 8 in that position to 7 I tried awk '{gsub("8","7",$35)}1' infile > outfile ----> not working sed -i 's/8/7'g' infile --- it is replacing all... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
KEYMOD(1p)						User Contributed Perl Documentation						KEYMOD(1p)

NAME
keymod - Modifies key parameters in a DNSSEC-Tools keyrec file SYNOPSIS
keymod [options] keyrec1 ... keyrecN DESCRIPTION
keymod modifies the key parameters in a keyrec file that are used to generate cryptographics keys used to sign zones. The new parameters will be used by zonesigner when generating new keys. It has no effect on existing keys. zonesigner will use the new parameter for a zone the next time it generates a key that requires that parameter. This means that, for example, a new ZSK length will not be used during the next invocation of zonesigner if that invocation will be performing KSK-rollover actions. The following fields may be modified: kskcount - count of KSK keys ksklength - length of KSK keys ksklife - lifetime of KSK keys random - random number generator device file revperiod - revocation period for KSK keys zskcount - count of ZSK keys zsklength - length of ZSK keys zsklife - lifetime of ZSK keys New key/value fields will be added to a zone keyrec file to inform zonesigner that new values should be used. The key portion of the added fields will begin with "new_". For example, a new KSK length of 2048 will be written to the keyrec file as: new_ksklength 2048 All zone records in the specified keyrec file will be modified, unless the -zone option is given. In that case, only the named zone will be modified. If a zone keyrec already contains a new key/value field, then the value will be modified on subsequent runs of keymod. OPTIONS
keymod recognizes the following options. Multiple options may be combined in a single keymod execution. All numeric values must be positive or zero. If a new key/value field should be deleted from a zone keyrec, then a zero or empty string value should be specified for the appropriate option. -zone zonename The zone keyrec whose name matches zonename is selected as the only keyrec that will be modified. If this name is not given, then all zone keyrec records will be modified. -ksklength ksklength The ksklength field will be modified in the selected keyrec records to the given value. This is a numeric field whose values depend on the cryptographic algorithm to be used to generate keys for the zone. -kskcount kskcount The kskcount field will be modified in the selected keyrec records to the given value. This is a numeric field. -ksklife ksklife The ksklife field will be modified in the selected keyrec records to the given value. This is a numeric field. -random random The random field will be modified in the selected keyrec records to the given value. This is a text field that will be passed to the key generator. -revperiod revperiod The revperiod field will be modified in the selected keyrec records to the given value. This is a numeric field. -zskcount zskcount The zskcount field will be modified in the selected keyrec records to the given value. This is a numeric field. -zsklength zsklength The zsklength field will be modified in the selected keyrec records to the given value. This is a numeric field whose values depend on the cryptographic algorithm to be used to generate keys for the zone. -zsklife zsklife The zsklife field will be modified in the selected keyrec records to the given value. This is a numeric field. -nocheck If this option is given, the krfcheck command will not be run on the modified keyrec file. -verbose Display information about every modification made to the keyrec file. -Version Displays the version information for keymod and the DNSSEC-Tools package. -help Display a usage message. COPYRIGHT
Copyright 2012 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. AUTHOR
Wayne Morrison, tewok@tislabs.com SEE ALSO
zonesigner(8), krfcheck(8) Net::DNS::SEC::Tools::keyrec.pm(3) file-keyrec(5) perl v5.14.2 2012-06-21 KEYMOD(1p)
All times are GMT -4. The time now is 01:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy