PDA

View Full Version : sed or awk for this?



vladuz976
May 8th, 2006, 09:58 AM
in this file (generated by LabView) i have an accidential line numbering only in the first column. is there a way i can use sed or awk to find those and either enter a space or just get rid of the leading line numbers all together?


0.000000000000 0.088205501437
1.030927777290 0.053163014352
2.061855554581 0.000151508051
3.092783451080 0.000118749449
4.123711109161 0.000104611187
5.154639244080 0.000155890026
6.185566902161 0.000116363604
7.216495037079 0.000135406299
8.247422218323 0.000159337462
9.278350830078 0.000080037527
10.309278488159 0.000142319623

asimon
May 8th, 2006, 03:14 PM
Do you mean like this?

$ sed -e 's/^[0-9]*\.//g' input
000000000000 0.088205501437
030927777290 0.053163014352
061855554581 0.000151508051
092783451080 0.000118749449
123711109161 0.000104611187
154639244080 0.000155890026
185566902161 0.000116363604
216495037079 0.000135406299
247422218323 0.000159337462
278350830078 0.000080037527
309278488159 0.000142319623

vladuz976
May 8th, 2006, 05:26 PM
Do you mean like this?

$ sed -e 's/^[0-9]*\.//g' input
000000000000 0.088205501437
030927777290 0.053163014352
061855554581 0.000151508051
092783451080 0.000118749449
123711109161 0.000104611187
154639244080 0.000155890026
185566902161 0.000116363604
216495037079 0.000135406299
247422218323 0.000159337462
278350830078 0.000080037527
309278488159 0.000142319623



like that but with a leading period:


.000000000000 0.088205501437
.030927777290 0.053163014352
.061855554581 0.000151508051
.092783451080 0.000118749449
.123711109161 0.000104611187
.154639244080 0.000155890026
.185566902161 0.000116363604
.216495037079 0.000135406299

or even a 0.


0.000000000000 0.088205501437
0.030927777290 0.053163014352
0.061855554581 0.000151508051
0.092783451080 0.000118749449
0.123711109161 0.000104611187
0.154639244080 0.000155890026
0.185566902161 0.000116363604
0.216495037079 0.000135406299

xenmax
May 8th, 2006, 05:44 PM
Sure,
sed -e 's/^[0-9]*\./0./' foo