nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

script to rewrite data.

This is a discussion on script to rewrite data. within the Shell scripting forums, part of the Development/Scripting category; I have a .txt file with numerical data in every line. how do i write a script to create a ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-15-2005, 08:32 AM
Junior Member
User
 
Join Date: Sep 2005
Posts: 24
Rep Power: 0
kavi
Default script to rewrite data.

I have a .txt file with numerical data in every line.
how do i write a script to create a new file with data from last to first. I mean the last data should be first in the new file, second last data should be second, etc and first data should be the last in the new file.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-15-2005, 03:18 PM
Administrator
Site Admin
 
Join Date: Jan 1970
Posts: 43
Rep Power: 10
vivek has disabled reputation
Default

Sorry but i'm not getting your idea. Let us assume

File A
Code:
A_Line_1
A_Line_2
A_Line_3
File B
Code:
B_Line_1
B_Line_2
B_Line_3
So what output you wanna? Somethink like as follows:
Code:
B_Line_1
B_Line_2
B_Line_3
A_Line_1
A_Line_2
A_Line_3
???
Reply With Quote
  #3 (permalink)  
Old 09-17-2005, 01:13 AM
kavi1
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by vivek
Sorry but i'm not getting your idea. Let us assume

File A
Code:
A_Line_1
A_Line_2
A_Line_3
File B
Code:
B_Line_1
B_Line_2
B_Line_3
So what output you wanna? Somethink like as follows:
Code:
B_Line_1
B_Line_2
B_Line_3
A_Line_1
A_Line_2
A_Line_3
???
well its like this: we only have file A with the lines as u have put above.
Now i want the output file lets say file B as
A_line3
A_line2
A_line1.
thats all
What should be the shell script (using sed??) to get file B?
Reply With Quote
  #4 (permalink)  
Old 09-18-2005, 12:13 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 481
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Look like this script written by vivek may help you http://bash.cyberciti.biz/file-manag...text-file.bash
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Redirect + Rewrite Problem in Lighttpd Lizard King Web servers 4 07-17-2007 09:44 AM
get data mysql from shell alpa Shell scripting 1 05-14-2007 06:02 PM
Script for accessing data .. Dastard Shell scripting 1 07-25-2006 11:12 PM
print data to txt rock Shell scripting 1 03-10-2006 02:01 AM
Script to extract a specific row of data ricc Shell scripting 1 11-15-2005 02:29 PM


All times are GMT +5.5. The time now is 01:45 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36