Sponsored Content
Top Forums Shell Programming and Scripting Replace column by random number addition Post 302720239 by Yoda on Tuesday 23rd of October 2012 04:21:05 PM
Old 10-23-2012
@msabhi, It works! Thank you very much.

One last request, if the 11th field digit is less than or equal to 3 digits I still want to generate a 1 digit random number and add it.

Can you please help with that?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed to replace second number in a random string

I need a sed line that will take STDM111 and change it to STDM161 the STDM will always be constant but the 3 numbers after will be random, I just need it to always replace the middle number with 6 regardless of what the numbers are. (8 Replies)
Discussion started by: glev2005
8 Replies

2. Shell Programming and Scripting

Previous Column Value (addition)

Good day, First off, I would just like to say that I've been helped by a lot of the posts here in my own scripting work in the past few months. I've been a long time roamer, but first time poster. That being said, I'm stuck trying to figure out this issue (For computational research, not a... (4 Replies)
Discussion started by: Eblue562
4 Replies

3. UNIX for Dummies Questions & Answers

replace all numbers in column with another number in bash

Hi, I've been trying to replace the numbers in the first column of my text file with all ones, unless the number is equal to 8. I have this: 1 1 11 123 258 2 1 9 135 175 1 1 15 143 274 8 1 13 153 172 8 1 13 154 166 8 1 13 154 167 3 1 15 237 255 4 1 15 243 202 1 1 13 133 166... (4 Replies)
Discussion started by: goodbenito
4 Replies

4. Shell Programming and Scripting

Using SED to replace a random number?

Hi all, I need to run a number of scripts which have a certain phrase on them so I have identified these by; grep -l 100 *script | sort -u Normally I could just run something along the lines of; for i in `grep -l 100 *script | sort -u`; do ./${i}; done However before I run each of... (0 Replies)
Discussion started by: JayC89
0 Replies

5. UNIX for Dummies Questions & Answers

Multiple number addition

Friends , Can u tel me how can i have done multiple addition using shell script ? Expected Output can be : 1 4 6 --------- Total - 11 (4 Replies)
Discussion started by: meetsubhas
4 Replies

6. Shell Programming and Scripting

Replace 2nd column for each line in a csv file with fixed string+random number

Hi experts, My csv file looks like this U;cake;michael;temp;;;; U;bread;john;temp;;;; U;cocktails;sarah;temp;;;; I'd like to change the value fo 2nd column to cf+random number , which will look maybe something like this U;cf20187;michael;temp;;;; U;cf8926;john;temp;;;;... (7 Replies)
Discussion started by: tententen
7 Replies

7. UNIX for Dummies Questions & Answers

how to generate random number as as the first column of a txt file

Dear all, I have a question. I have a txt file say 4000 rows X 1800 Column. I 'd like to creat a new column as the first column which is a column of random numbers (n=4000) thanks a lot! Lin (2 Replies)
Discussion started by: forevertl
2 Replies

8. Shell Programming and Scripting

Find number of characters in a column and replace

Hi all, I want to count total no. of characters in a column. and if no. of charaters are more than 3 then it must replace it by splitted string. ie, it must place a space after 3 characters. Ex: 21 435g asd3dd jklfjwe wer column number 3 has 4 alphanumeric character, so it must be splitted... (3 Replies)
Discussion started by: CAch
3 Replies

9. Shell Programming and Scripting

Group/concatenate certain column and basis on this do addition on other column

Hi Experts, Need your support I want to group/concatenate column 1,2,12 and 13 and if found duplicate then need to sum value of column 17,20,21 and column22. After concatenation if found unique then no action to be taken. Secondly want to make duplicate rows basis on grouping/concatenation of... (1 Reply)
Discussion started by: as7951
1 Replies

10. Shell Programming and Scripting

Replace all string matches in file with unique random number

Hello Take this file... Test01 Ref test Version 01 Test02 Ref test Version 02 Test66 Ref test Version 66 Test99 Ref test Version 99 I want to substitute every occurrence of Test{2} with a unique random number, so for example, if I was using sed, substitution would be something... (1 Reply)
Discussion started by: funkman
1 Replies
CheckDigits::MXX_004(3pm)				User Contributed Perl Documentation				 CheckDigits::MXX_004(3pm)

NAME
CheckDigits::MXX_004 - compute check digits for VAT RN (AT) SYNOPSIS
use Algorithm::CheckDigits; $vat = CheckDigits('ustid_at'); if ($vat->is_valid('U13585627')) { # do something } $cn = $vat->complete('U1358562'); # $cn = 'U13585627' $cd = $vat->checkdigit('U13585627'); # $cd = '7' $bn = $vat->basenumber('U13585627'); # $bn = 'U1358562' DESCRIPTION
ALGORITHM 1. Beginning right all numbers before the check digit are weighted alternatively 1 and 2. 2. The total of the digits of all products is computed and then subtracted from 96. 3. The check digit is the sum of step 3 taken modulo 10. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. perl v5.10.0 2008-05-17 CheckDigits::MXX_004(3pm)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy