What would be the sed command to match the number 1.05897234566427
Note, that I only know that the pattern starts with 1.05, and I would like to match it and write it along with the rest numbers after 1.05 into another file (output.txt), but not the entire line!!!
Is it possible sed to handle something like this? If you know just the first 2 or 3 digits of a number, to match the whole number.
Finally, the output file must contain 1.05897234566427 only.
Thanks again,
this works fine too.
Where did you learn all these? Could you recommend a good tutorial of sed?
I must confess that I spent few days in trying to solve that, unfortunately unsuccessful.
My original code was:
but it printed the entire line.
I need to grasp the logic of all that.
Regards
Last edited by Franklin52; 06-27-2011 at 03:05 AM..
Reason: Please use code tags for code and data samples, thank you
Тhank you very much for the link. I'll pay a special attention to it.
Regards.
---------- Post updated at 11:49 AM ---------- Previous update was at 12:38 AM ----------
hi again guys.
How about if I want to do some arithmetic with my values in the file above, using sed?
For example: If I would like to increase or decrease the number 1.05897234566427 with the amount of 0.001. So, the final result to be 1.05997234566427 or 1.05797234566427.
I've tried the following but unsuccessful:
Unfortunately, I ged: expr ^\(1\.05[0-9]*\).*+$q instead of 1.05997234566427.
Any ideas how to solve that.
I need that solution since, I am going to embed sed inside a loop which should change certain values approximately 100000 times. It will rather huge loop.
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
Hi all!
Thanks for taking the time to view this!
I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern.
Example:
Drink a soda
Eat a banana
Eat multiple bananas
Drink an apple juice
Eat an apple
Eat multiple apples
I... (8 Replies)
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Ive used this snippet of code on a solaris box thousands of times.
But it isnt working on the new linux box
sed -n '/interface LoopBack0/{N;/ ip address /p;}' *.conf
its driving me nuts !!
Is there something Im missing ? (7 Replies)
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Hi,
I would like to use SED to do the following string replacement:
asd1abc to www1cda
asd2abc to www2cda
...
asd9abc to www9cda
I can use 'asd.abc' to find the orignal string, however I don't know how to generate the target string. Any suggestion?
Thanks,
... (2 Replies)
Hi,
I have file 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433... (4 Replies)
Hi,
I think you ppl did not get my question correctly, let me explain
I have 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
... (1 Reply)
Hi,
I am new to this forum and i would like to get help in this issue.
I have a file 1.txt as shown:
apple
banana
orange
apple
grapes
banana
orange
grapes
orange
....
Now i would like to search for pattern say apple or orange and then put a # at the beginning of the pattern... (2 Replies)