Solved

big tarfiles to lex

Posted on 1997-12-01
2
208 Views
Last Modified: 2010-04-21
I've very big tar-files with eMails in it.
My lex-Programm should work with the content of these files.
The Problem: When I pipe it to lex like this:
more tarfile | lexprogram >output
it ends with a broken pipe.
When I try it like this
lexprogram <tarfile >output
the program will abbort after the same time (I guess yywrap stopps the program).
0
Comment
Question by:bodirsky
2 Comments
 

Expert Comment

by:xilef
ID: 2008170
Hm, shouldn't you first extract your tarfile?

Something like:
cd /tmp/mydir
tar -xf /path/to/my/tarfile.tar
cat * | lexprogram

(The last line should probably be a loop for each of the files if there are really MANY files. The loop depends on the shell).

0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 2008171
tar files contain null bytes (0x0). Most lex flaviours treat this as an EOF. Your must take care for them before the default action (.)
Check your lex manual, or switch over to flex (which can handle null bytes ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now