nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

contents of files

This is a discussion on contents of files within the Shell scripting forums, part of the Development/Scripting category; Hmm If you are looking at speed then C app will do the job. As far as ^M ..... it ...


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

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #11 (permalink)  
Old 09-02-2005, 07:30 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Hmm
If you are looking at speed then C app will do the job. As far as ^M ..... it meant enter key. So your data file is from Windows/DOS? or what? They can be removed with sed:
Code:
sed 's/\r//' $OFILE > /tmp/final.out
Code:
sed -i '' "s/\r//g" $OFILE
Code:
tr -d "\015" < $OFILE > /tmp/final.out
I can add few more commands...
Reply With Quote
Sponsored Links
  #12 (permalink)  
Old 09-04-2005, 07:57 AM
guest
Guest
 
Posts: n/a
Default

No actually the data is provided as library data which is meant for viewing only. Dont think it is from DOS

would be glad to see few more commands monk.
thanx a lot for i have been learning shell script more by experimenting.......
Reply With Quote
  #13 (permalink)  
Old 09-04-2005, 08:07 AM
guest
Guest
 
Posts: n/a
Default

also,
what if i want some lines deleted. From those 193 lines of data, i might have to delete some selected lines based on column one data ( which we have erased from the original data) in all the .txt files. I know that i have to write a new file say test.sed in which i write down all patterns which i want to be modified and then use
$ sed -f test.sed INPUTFILE.TXT
havent understood much about the pattern finding and deleting whole line from file!
once all the .txt files are modified ( we can also delete the first 27 line we can append all the column two data in a single final file and ofcourse remove the ^M from the files.
what do u advise?
Reply With Quote
  #14 (permalink)  
Old 09-13-2005, 08:41 AM
Junior Member
User
 
Join Date: Sep 2005
Posts: 24
Rep Power: 0
kavi
Default reversing the data order

How do i reverse the data order. right now output_file had data in descending order based on column one data. I want the last data to be at the beginning of file.

to put it simply, right now data in the output file is 14.232, 13.2332, 2.343, 6.89, .........10.23, 11.234.
But i would like the file to be 11.234, 10.23, .......6.89, 2.343, 13.2332, 14.232.
Havent thought much about it. Any ideas?
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
UNIX list a backup tape contents chiku Getting started tutorials 0 04-27-2007 05:46 PM
Shell script for automatic conversion of files in tar files kasimani Shell scripting 2 02-08-2007 04:45 PM


All times are GMT +5.5. The time now is 05:34 PM.


Powered by vBulletin® Version 3.7.4 - 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