Printing 1st 200 lines of every file

Printing 1st 200 lines of every file

Post by Erwin Susant » Thu, 10 Aug 2000 04:00:00



Hi Unix experts:

Is there anyway I can make a script which will print the first 200 lines for
every file in the current directory ?

Thank you for the help in advance

 
 
 

Printing 1st 200 lines of every file

Post by Andreas Kaha » Thu, 10 Aug 2000 04:00:00




>Hi Unix experts:

>Is there anyway I can make a script which will print the first 200 lines for
>every file in the current directory ?

>Thank you for the help in advance

for f in *; do head -n 200 $f; done

/A

--
# Andreas K?h?ri, <URL:http://hello.to/andkaha/>.
# ...brought to you from Uppsala, Sweden.
# All junk e-mail is reported to the appropriate authorities.
# Criticism, cynicism and irony available free of charge.

 
 
 

Printing 1st 200 lines of every file

Post by Slava Kosarevyc » Thu, 10 Aug 2000 04:00:00


If you use ksh:

for file in *
do
    [[ ! -f $file ]] && continue
    print "File:$file"
    head -200 $file
done




> >Hi Unix experts:

> >Is there anyway I can make a script which will print the first 200 lines
for
> >every file in the current directory ?

> >Thank you for the help in advance

> for f in *; do head -n 200 $f; done

> /A

> --
> # Andreas K?h?ri, <URL:http://hello.to/andkaha/>.
> # ...brought to you from Uppsala, Sweden.
> # All junk e-mail is reported to the appropriate authorities.
> # Criticism, cynicism and irony available free of charge.

 
 
 

Printing 1st 200 lines of every file

Post by Ken Pizzi » Fri, 11 Aug 2000 04:00:00



>Is there anyway I can make a script which will print the first 200 lines for
>every file in the current directory ?

head -200 *

                --Ken Pizzini

 
 
 

Printing 1st 200 lines of every file

Post by Andreas Kaha » Fri, 11 Aug 2000 04:00:00



>On Wed, 9 Aug 2000 22:28:57 +1000, Erwin Susanto

>>Is there anyway I can make a script which will print the first 200 lines for
>>every file in the current directory ?

>head -200 *

>            --Ken Pizzini

Neat, but will probably print the file names as well.

Another solution: head -q -n 200 *

The loop in my other post lets you check for file type too (to ignore
pipes, fifos and directories), as Slava did in the followup.

To see the first 200 lines of every file in the PWD recursively, do
something like

find . -type f -exec head -n 200 {} \;

/A

--
# Andreas K?h?ri, <URL:http://hello.to/andkaha/>.
# ...brought to you from Uppsala, Sweden.
# All junk e-mail is reported to the appropriate authorities.
# Criticism, cynicism and irony available free of charge.

 
 
 

Printing 1st 200 lines of every file

Post by Artur Penttine » Fri, 11 Aug 2000 04:00:00


ES> Hi Unix experts:
ES>
ES> Is there anyway I can make a script which will print the first 200 lines for
ES> every file in the current directory ?

  for i in *; do head -n 200 $i | lpr; done

                                        WBW, Artur

--
You know better than to trust a strange computer.

 
 
 

1. 200 files created every day!

I'm using SCO ODT 3.0 and every day I get approximately 200 new files in
the folowing directories:

/usr/spool/mmdf/lock/home/addr
/usr/spool/mmdf/lock/home/q.local
/usr/spool/mmdf/lock/home/msg

Some of those files have this text (with the date  and time changing):

-----------------------------------------------------

X-Mailer: SCO System V Mail (version 3.2)
To: sys
Date: Sun, 4 aug 96 4:00:03 EDT

Cron: can't change directory to your home directory.
Your command will not be executed.
-----------------------------------------------------

I can erase those files every day but I want a permanent solution.
How should I correct this problem? It's really bugging me.

2. Get Display In Unix

3. sed query ... printing every nth line of text file

4. MacAlly 2-button ADB mouse

5. print line 1 of each file, line 2 of each file...

6. Case-sensitivity issues when using Chameleon

7. print 1st & 2nd line using nawk...

8. LILO problem when booting to linux partition?

9. Use of laserjet and magicfilter cause 1st 3 lines not to print

10. urgent - print 1st and 2nd line in nawk...

11. BJC-4200 prints every other line!

12. function key to go up to 1st line & down to last line in vi editor

13. printing every other line with sed