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
FBSQL_FETCH_ARRAY(3)							 1						      FBSQL_FETCH_ARRAY(3)

fbsql_fetch_array - Fetch a result row as an associative array, a numeric array, or both

SYNOPSIS
array fbsql_fetch_array (resource $result, [int $result_type]) DESCRIPTION
fbsql_fetch_array(3) is a combination of fbsql_fetch_row(3) and fbsql_fetch_assoc(3). An important thing to note is that using fbsql_fetch_array(3) is NOT significantly slower than using fbsql_fetch_row(3), while it provides a significant added value. PARAMETERS
o $ result -A result identifier returned by fbsql_query(3) or fbsql_db_query(3). o $result_type - A constant and can take the following values: FBSQL_ASSOC, FBSQL_NUM, or FBSQL_BOTH. When using FBSQL_BOTH, in addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys. RETURN VALUES
Returns an array that corresponds to the fetched row, or FALSE if there are no more rows. If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of the same name, you must the numeric index of the column or make an alias for the column. select t1.f1 as foo t2.f1 as bar from t1, t2 EXAMPLES
Example #1 fbsql_fetch_array(3) example <?php fbsql_connect($host, $user, $password); $result = fbsql_db_query("database", "select user_id, fullname from table"); while ($row = fbsql_fetch_array($result)) { echo "user_id: " . $row["user_id"] . "<br /> "; echo "user_id: " . $row[0] . "<br /> "; echo "fullname: " . $row["fullname"] . "<br /> "; echo "fullname: " . $row[1] . "<br /> "; } fbsql_free_result($result); ?> SEE ALSO
fbsql_fetch_row(3), fbsql_fetch_assoc(3), fbsql_fetch_object(3). PHP Documentation Group FBSQL_FETCH_ARRAY(3)
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy