четвъртък, 9 април 2015 г.

Cool uses of sed

I really fell in love with this site: sed - 20 examples to remove / delete characters from a file . 
To remove first character only if it is a specific character:
$ sed 's/^F//' file > file.new
Pretty cool when you need to deal with 10 000 incompatible ways to comment in Fortran.
Also, one Fortran note to self:
To fix deprecated assign to and go to:

(a) change each of the ASSIGN N TO NEXT (where N is some number) statement to a simple NEXT = N statement (where N is the same number), and

(b) replace each of the GO TO NEXT, (x, y, z, ...) statement with the following computed goto statement

GO TO (1,2,3,4,5,6,7,8,9,10,11) NEXT

Няма коментари:

Публикуване на коментар