Head: Difference between revisions
From Hackepedia
Jump to navigationJump to search
m New page: Head is a program that allows you to print the first X lines of a file. It looks a little like this: $ head -4 /var/run/dmesg.boot OpenBSD 4.3 ... |
No edit summary |
||
Line 6: | Line 6: | ||
cpu0: AMD Athlon(tm) 64 Processor 3500+ ("AuthenticAMD" 686-class, 512KB L2 cache) 2.33 GHz | cpu0: AMD Athlon(tm) 64 Processor 3500+ ("AuthenticAMD" 686-class, 512KB L2 cache) 2.33 GHz | ||
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2 | cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2 | ||
To get the last few lines of a file use [[tail]]. This can also be done with the programs [[sed]] and [[awk]]. |
Latest revision as of 09:58, 3 July 2008
Head is a program that allows you to print the first X lines of a file. It looks a little like this:
$ head -4 /var/run/dmesg.boot OpenBSD 4.3 (GENERIC) #0: Sun May 11 13:04:18 CEST 2008 root@francisco.solarscale.de:/usr/src/sys/arch/i386/compile/GENERIC cpu0: AMD Athlon(tm) 64 Processor 3500+ ("AuthenticAMD" 686-class, 512KB L2 cache) 2.33 GHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2
To get the last few lines of a file use tail. This can also be done with the programs sed and awk.