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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
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: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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 
|
|
|
All times are GMT -5. The time now is 11:34 PM.
|
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
|
|