find and head -1


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find and head -1
# 1  
Old 04-30-2010
find and head -1

i have lots of files in /law/prod and /law/dev, such as AP20PD, AP20WS, AP20.scr, AP20.rpt

if i am in /law DIR

Code:
find . -name AP20PD, found in /law/prod and /law/dev

i want to head -1 AP20PD from both location and >> /tmp/test.log


can i use find and head in one line ?

---------- Post updated at 08:39 AM ---------- Previous update was at 07:57 AM ----------

never mine. find . -name filename > /tmp/test.log and then i use while loop to head -1 does the trick for me. thank you anyway.

Last edited by zaxxon; 04-30-2010 at 10:25 AM.. Reason: use code tags please, ty
# 2  
Old 04-30-2010
Or you can use the following:

Code:
find . -name AP20PD -type f -exec head -1 {} \; >> /tmp/test.log

Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

How to find the head cleaning history on HP HP MSL4048 1 LT0-4 Ultrium 1840?

Please guide me how to get the head cleaning history on HP HP MSL4048 1 LT0-4 Ultrium 1840. (0 Replies)
Discussion started by: marunmeera
0 Replies

2. Homework & Coursework Questions

Unix find and head command help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I've been stuck on this problem for 2 days now What command would you enter to list the first lines of all text... (11 Replies)
Discussion started by: partieboi37
11 Replies

3. Shell Programming and Scripting

Remove head for all the files

Hi all, i need to remove the header for all the files which is ending with .csv and append into one file example, test1.csv test2.csv test3.csv i tried with the below command, sed '1d' test*.csv> appendnew.csv but it deletes only the first file header. and appending all the... (11 Replies)
Discussion started by: baskivs
11 Replies

4. Shell Programming and Scripting

head followed by variable??

I know that the common use of head is for example head -3 etc.Is there any possibility that,if i have a variable that equals to an integer(i=5),i can write head -i?? If not,what syntax or commands should i write down in order to have the same result? //maybe something lik head -"$variable" ? (2 Replies)
Discussion started by: bashuser2
2 Replies

5. UNIX for Dummies Questions & Answers

alternative for head command

Hi friends,I am new to unix and this is really a dummy question.but please help me out. How to simulate head command without using head command??? also tail command too,also more command. it is given as a homework to do....please tell me how to do (2 Replies)
Discussion started by: nikhilneela
2 Replies

6. Shell Programming and Scripting

head usage

$ct=1 head -n $ct file. When i used like this, i got an error , Bad usage of head Cant we use variables in place of number in HEAD. In my requirement for every iteration i should increase the number in Head and tail the last one. HOw can i achieve this (5 Replies)
Discussion started by: vasuarjula
5 Replies

7. Programming

http HEAD reuest

I have written a c socket programe which can send the http GET request.But it dont work for HEAD reuest.can anyone help me.I am connected to internet via a proxy and the port/ip in the programe are proxies ones -------------------------------------------------- #include <stdlib.h> #include... (3 Replies)
Discussion started by: chamaraHe
3 Replies

8. Shell Programming and Scripting

head command

Hi All, How can the head command be used to extract only a particular line. By default head -n filename displays the first n lines. I want only the nth line. I couldn't get it from forum search. Thanks, Sumesh (6 Replies)
Discussion started by: sumesh.abraham
6 Replies

9. UNIX for Dummies Questions & Answers

simple 'head' question

I'm sorry, but the example in the man pages was no help. I know head -5 fileName will give you the first 5 lines of the file but how do you get like the 6th-13th lines only or one line before the end of the file? Sorry I just started learning the basics..... =( (3 Replies)
Discussion started by: terms5
3 Replies

10. UNIX for Dummies Questions & Answers

help.. I am in way over my head !!!!

my boss has done it again I have been sent to fix a unix issue and I ma hoping you can help three issues 1st. I have a printer that when you try to print to it the print job comes out on a diffrent printer. If I take the printer ( dot matrix thourgh a serail connection) to a diffrent local the... (3 Replies)
Discussion started by: oberon42
3 Replies
Login or Register to Ask a Question