help with !(tail -2) command.. using pipes


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users help with !(tail -2) command.. using pipes
# 8  
Old 02-17-2005
You can combine 2 awk steps into one .....

Code:
ls -lt *.log | awk '{ if (NR > 3) print substr($9,1,14) }' | sort -u

# 9  
Old 02-17-2005
if you just want the filenames (and do not need the other fields), you can just do this:
ls -t *log|tail +3
this will give all files except the latest two. besides, awk is slower than this
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Limit on number of pipes after long-running command?

I'm trying to create a minimal, crude keylogger for X using only a shell script. I was quickly stumped: Why do these two commands entered in a terminal emulator produce output when I type... $ xinput test 6 | grep press $ xinput test 6 | awk '{print $3}' ...but this command produces no... (13 Replies)
Discussion started by: DevuanFan
13 Replies

2. UNIX for Beginners Questions & Answers

Tail -f Command help

Hi Team, Can anyone help me here: I have to access server logs via putty and these logs file is a trailing file (continously updating) with ERROR and WARNINGS... I need to know if I can pull this trailing file to a local drive so that I can do some higlighting on some keywords through Notepad... (13 Replies)
Discussion started by: jitensetia
13 Replies

3. Shell Programming and Scripting

tail command help

Hi does anyone know how to create a file using the tail command? My book has this file I need to create and it says to use the tail command and that it is possible but I have no idea. Thanks. (4 Replies)
Discussion started by: drew211
4 Replies

4. Shell Programming and Scripting

tail command problems

Hi, In my home directory, there are so many files. i tried to get the lastly created file by following command. file=`ls -lrt MXOfiles* | tail -1` As there are so many files, it displays "$ : 0403-027 The parameter list is too long." Can someone tell me how can i get the recent file... (1 Reply)
Discussion started by: JSKOBS
1 Replies

5. Shell Programming and Scripting

Using pipes in a find command

How are pipes used inside a find -exec clause? I want to traverse a directory tree and find all of the shell scripts, and then based on that I need to perfrom further processing. So I have something like find . -name \* -exec "file {} \| grep 'script' > /dev/null" \; -ls with -ls as a simple... (6 Replies)
Discussion started by: JerryHone
6 Replies

6. Shell Programming and Scripting

Help with tail command

Hi All, My query seems to be silly but Iam unable to find where the exact problem lies. I have a script to unzip set of files here is the script #!/bin/ksh Count=`cat /home/gaddamja/Tempfile | wc -l` while do Filename=`cat /home/gaddamja/Tempfile |tail -$Count | head -1` cd... (7 Replies)
Discussion started by: jagadish_gaddam
7 Replies

7. Shell Programming and Scripting

Multiple pipes toward a single awk command

Hello, I would like to pipe two variables into awk, but I don't know how to do. Each variable, "a" and "b", are in fact a list of data. They are not files. So to get awk to work with it I am using: echo $a | awk 'FNR==NR{print $1}FNR!=NR{print $4}' The above works, but when I am... (5 Replies)
Discussion started by: jolecanard
5 Replies

8. Shell Programming and Scripting

tail command..

I was wondering how can I do this I have file myfile.txt wc -l is: 5 000 000 I have to remove first 1 000 000 lines from header.. I tryed with tail -4000000 myfile.txt>newfile.txt but it does not work... any help?? (2 Replies)
Discussion started by: amon
2 Replies

9. Shell Programming and Scripting

tail command

Hi , I have found a interesting thing about tail command: when I tried to use 'tail -1 *' to look at every file with the current derectory, I only got one line of result of one file. But if I use 'head -1 *', I would get multiple lines. Is there a way to do get multiple lines with 'tail -1 *'... (3 Replies)
Discussion started by: whatisthis
3 Replies

10. Filesystems, Disks and Memory

PIPEs and Named PIPEs (FIFO) Buffer size

Hello! How I can increase or decrease predefined pipe buffer size? System FreeBSD 4.9 and RedHat Linux 9.0 Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
Login or Register to Ask a Question