LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   More text manipulation (https://www.linuxquestions.org/questions/linux-general-1/more-text-manipulation-327671/)

ice_hockey 05-27-2005 09:36 AM

More text manipulation
 
I have a text file in the form:

01abc
01def
02xyz
02abc
03qwe
99qwe

I want to convert it to:

abc01
def01
xyz02
abc02
qwe03
qwe99

Any ideas?

c_olin3404 05-28-2005 01:29 AM

write a program that reads each line as a string, and simply take the last three letters and then put the first two on the end, and print it to a new file.

C/C++ could easily do this in a simple program. Just look for a tutorial about file input/output and string manipulation.

ivanatora 05-28-2005 01:43 AM

Perl could do the job even more easily. String manipulation is its strength and flexibility.
If you aren't very fond of Perl, you might try with bash script using 'sed' command, it's almost the same.


All times are GMT -5. The time now is 03:53 PM.