Posts tagged unix

Null characters in file

0

Some program could not handle interfacing files which contains null characters and has often causes support people lots of run around to find the cause.

A simple way to identify the locations of null characters in a flat file is by using the following command. Works well each time for me. :)

 

tr ‘\0′ ‘@’ < INPUT_FILE > OUTPUT_FILE

 

I LOVE UNIX!

Extract first 100 lines from a file in UNIX

0

I was tasked to get first 100 lines of records from a database dump. While searching big brother G, I found the solution here:- how to extract a range of lines from a file provided by zazzybob.

Here’s the solutions:-

You could also pipe though sed to extract the range – e.g.
blah | sed -n ’1,1000p’ | blah
to extract the first 1000 lines of the file

How I uses it:-

cat file.unl | sed -n ’1,100p’ > out100.unl

Cheers.

Go to Top