4gig file trying to replace decimal number A with decimal number B
I want to change one number string, to another.
I thought it would be easy. But, I'm not finding it. I thought sed would be just the thing. I tried the following. But, it does not change the numnber. sed -n 's/ 6947465.41/ 6947477.98/' minv_tst.txt This is the record, in the file (wrapped): 1109 111 111 0 0 0 0 0 0 6947465.41 5792148 592988.7 Any ideas with sed, or other linux tools, please let me know. I am on Centos 6 Thank you |
Quote:
Try Code:
sed -i 's/ 6947465.41/ 6947477.98/g' minv_test.txt |
Thank you for the quick response.
It worked! I'm not new to linux. But, I've never used sed or awk. I'll tell you, I tried, I don't know how many variations of that code. I did use the "-i" once or twice. But, I used it along with other "-" options. When I did that, it actually Zeroed my file. Anyway, Thank you again! Tony |
Quote:
Quote:
|
And be very careful doing global changes. Usually pays to check how many records will be affected first before allowing the change.
|
Being pedantic, I would escape the period in the search expression, so that the search includes a literal decimal point rather than a match for any character.
Code:
sed -i 's/ 6947465\.41/ 6947477.98/g' minv_test.txt |
All times are GMT -5. The time now is 07:59 AM. |