Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-24-2005, 02:42 PM
|
#1
|
|
LQ Newbie
Registered: Feb 2005
Location: Waldorf, MD
Distribution: Red Hat Enterprise/SuSe Linux
Posts: 6
Rep:
|
using DD to pull records out of a data file
I there any way to use DD to pull the last 500 records? without knowing how many records total there are, and simply subtracting 500 from that and saying skip (that number)??
Last edited by fhinkle; 02-24-2005 at 02:43 PM.
|
|
|
|
02-24-2005, 02:56 PM
|
#2
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Nope ... dd references everything from the beginning
of file. But if the records are lines (\n - separated) you
could use tail -n 500
Cheers,
Tink
|
|
|
|
02-24-2005, 03:28 PM
|
#3
|
|
LQ Newbie
Registered: Feb 2005
Location: Waldorf, MD
Distribution: Red Hat Enterprise/SuSe Linux
Posts: 6
Original Poster
Rep:
|
thats what i thought....
figured it couldn't hurt to ask...
and of course it wouldn't be so easy that the records were all on new lines,
I am working on getting a math expression down for it now...
|
|
|
|
02-24-2005, 03:49 PM
|
#4
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Well ... if it has SOME sort of designated delimiter you
could always pipe it through awk and run tail against
its output ...
Cheers,
Tink
|
|
|
|
02-24-2005, 03:56 PM
|
#5
|
|
LQ Newbie
Registered: Feb 2005
Location: Waldorf, MD
Distribution: Red Hat Enterprise/SuSe Linux
Posts: 6
Original Poster
Rep:
|
i guess i should explain what i am doing a little more
I am taking a file with ebcdic data in it, and trying to take the first 500 reords, convert them to ascii, then output to a file. and the same for the last 500 records to a different file. I haven't been informed of a delimiter of any kind, I was just told to go by byte length for the records. I guess this is the reason they want me using DD.
|
|
|
|
02-24-2005, 04:10 PM
|
#6
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Oh, I see :)
So they have a fixed record length? In that case getting
the last 500 mathematically is trivial, neh? :)
And I agree, considering the EBCDIC/ASCII conversion
dd would be the best tool for the job :)
Cheers,
Tink
|
|
|
|
02-24-2005, 04:20 PM
|
#7
|
|
LQ Newbie
Registered: Feb 2005
Location: Waldorf, MD
Distribution: Red Hat Enterprise/SuSe Linux
Posts: 6
Original Poster
Rep:
|
yeah, I got it all done now... I was just trying to avoid using math if i could.
thanks for the help 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:45 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|