Advertisement

05.09.2008 at 10:33AM PDT, ID: 23390231
[x]
Attachment Details

Extracting Data from a text file using SED

Asked by ITD_Technician in MS DOS, Linux, Miscellaneous Programming

Tags: Microsoft, Windows

I am trying to extract some information from a text file using SED.

Here is the sample input:
-rw-rw-r--   1     1994     1994 47137269 May  9 15:47 filename05_18_2008.exe

I need to extract the number 47137269 from the file and write it to another. But that number could change. I need a script that will search for the second occurrence of 1994 and extract the info after it, in between the two spaces.

This is the output from an ftp site, to download a program update periodically.

What I want to end up doing is eventually compare file sizes to verify download completion.

Help is greatly appreciated as my knowledge of SED is very limited.
Start Free Trial
 
Loading Advertisement...
 
[+][-]05.09.2008 at 10:40AM PDT, ID: 21535016

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 10:41AM PDT, ID: 21535026

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 10:42AM PDT, ID: 21535036

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 01:52PM PDT, ID: 21536335

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 02:09PM PDT, ID: 21536425

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS DOS, Linux, Miscellaneous Programming
Tags: Microsoft, Windows
Sign Up Now!
Solution Provided By: ITD_Technician
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628