LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-27-2005, 09:36 AM   #1
ice_hockey
LQ Newbie
 
Registered: Apr 2005
Posts: 11

Rep: Reputation: 0
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?
 
Old 05-28-2005, 01:29 AM   #2
c_olin3404
Member
 
Registered: Jan 2004
Posts: 131

Rep: Reputation: 15
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.
 
Old 05-28-2005, 01:43 AM   #3
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file manipulation with c C.Aymen Programming 2 09-01-2005 12:48 PM
Manipulation of text files in C++ Hady Programming 5 05-31-2005 08:24 AM
[C/C++] Image manipulation Cornholio Programming 2 03-06-2005 11:46 AM
help with data manipulation SeT Programming 2 10-20-2004 07:32 AM
CLI based Text manipulation selfsck Linux - General 1 07-15-2004 07:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration