Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Simple Command (head) Question Post 302071685 by jbud on Sunday 23rd of April 2006 07:12:25 PM
Old 04-23-2006
Simple Command (head) Question

Okay, this probably sounds dumb for anyone who knows the answer, but I'm completely lost. I have to use the head command to search a directory AND all of its subdirectories to display the first line of all .txt files. I know how to do this: head -1 ~/UnixCourse/*.txt, but that does not search the subdirectories. I've tried to figure it out on my own and use help resources, but had no luck. I would really appreciate if someone could save me a little time and effort by helping me out here.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

SImple command question

Does anyone know the command to get the date CREATED for a file? This is driving me berserk. Windows has it. But I cannnnnnot remeber what it is in UNIX! Thanks! (4 Replies)
Discussion started by: Diabeticus
4 Replies

2. 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

3. 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

4. Shell Programming and Scripting

The cut command. Really simple question!

hi, sorry for asking what I am sure is a really easy question, I am wanting to cut the users real name from the output of 'finger'. $ cut -f2-3 filename is in my script but it only seems to cut the first line. I need to cut the 2nd and 3rd word from each line and store them in variables... (1 Reply)
Discussion started by: rorey_breaker
1 Replies

5. Shell Programming and Scripting

Simple question abt Copy command.

Hi ! All This is very simple question.... How to write a 'cp' command interative. Example : cp /wlsuite/om/cm/Tools/deploy_scripts/*.xml ${INF_ROOT}/tmp | echo "" || echo " Pls investigate ..." My intent was > to copy the files. > CP fails... then let know the user. pls... (2 Replies)
Discussion started by: dashok.83
2 Replies

6. 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

7. Shell Programming and Scripting

Diff/head - not sure if this is the right command to use

Hi, I need some advise on whether there is a better way of doing what I am currently planning to do. Perhaps I should be using arrays instead of re-directing output to files? I need to use a tool/program named ADRCI provided by Oracle to remove trace files that it generates. Honestly it is... (1 Reply)
Discussion started by: newbie_01
1 Replies

8. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

9. Linux

A simple question about mail command

Simple question: i read mail n°4,how to return to list of messages? (2 Replies)
Discussion started by: Linusolaradm1
2 Replies
LWP::Simple(3)						User Contributed Perl Documentation					    LWP::Simple(3)

NAME
LWP::Simple - simple procedural interface to LWP SYNOPSIS
perl -MLWP::Simple -e 'getprint "http://www.sn.no"' use LWP::Simple; $content = get("http://www.sn.no/"); die "Couldn't get it!" unless defined $content; if (mirror("http://www.sn.no/", "foo") == RC_NOT_MODIFIED) { ... } if (is_success(getprint("http://www.sn.no/"))) { ... } DESCRIPTION
This module is meant for people who want a simplified view of the libwww-perl library. It should also be suitable for one-liners. If you need more control or access to the header fields in the requests sent and responses received, then you should use the full object-oriented interface provided by the "LWP::UserAgent" module. The following functions are provided (and exported) by this module: get($url) The get() function will fetch the document identified by the given URL and return it. It returns "undef" if it fails. The $url argument can be either a string or a reference to a URI object. You will not be able to examine the response code or response headers (like 'Content-Type') when you are accessing the web using this function. If you need that information you should use the full OO interface (see LWP::UserAgent). head($url) Get document headers. Returns the following 5 values if successful: ($content_type, $document_length, $modified_time, $expires, $server) Returns an empty list if it fails. In scalar context returns TRUE if successful. getprint($url) Get and print a document identified by a URL. The document is printed to the selected default filehandle for output (normally STDOUT) as data is received from the network. If the request fails, then the status code and message are printed on STDERR. The return value is the HTTP response code. getstore($url, $file) Gets a document identified by a URL and stores it in the file. The return value is the HTTP response code. mirror($url, $file) Get and store a document identified by a URL, using If-modified-since, and checking the Content-Length. Returns the HTTP response code. This module also exports the HTTP::Status constants and procedures. You can use them when you check the response code from getprint(), getstore() or mirror(). The constants are: RC_CONTINUE RC_SWITCHING_PROTOCOLS RC_OK RC_CREATED RC_ACCEPTED RC_NON_AUTHORITATIVE_INFORMATION RC_NO_CONTENT RC_RESET_CONTENT RC_PARTIAL_CONTENT RC_MULTIPLE_CHOICES RC_MOVED_PERMANENTLY RC_MOVED_TEMPORARILY RC_SEE_OTHER RC_NOT_MODIFIED RC_USE_PROXY RC_BAD_REQUEST RC_UNAUTHORIZED RC_PAYMENT_REQUIRED RC_FORBIDDEN RC_NOT_FOUND RC_METHOD_NOT_ALLOWED RC_NOT_ACCEPTABLE RC_PROXY_AUTHENTICATION_REQUIRED RC_REQUEST_TIMEOUT RC_CONFLICT RC_GONE RC_LENGTH_REQUIRED RC_PRECONDITION_FAILED RC_REQUEST_ENTITY_TOO_LARGE RC_REQUEST_URI_TOO_LARGE RC_UNSUPPORTED_MEDIA_TYPE RC_INTERNAL_SERVER_ERROR RC_NOT_IMPLEMENTED RC_BAD_GATEWAY RC_SERVICE_UNAVAILABLE RC_GATEWAY_TIMEOUT RC_HTTP_VERSION_NOT_SUPPORTED The HTTP::Status classification functions are: is_success($rc) True if response code indicated a successful request. is_error($rc) True if response code indicated that an error occurred. The module will also export the LWP::UserAgent object as $ua if you ask for it explicitly. The user agent created by this module will identify itself as "LWP::Simple/#.##" and will initialize its proxy defaults from the environment (by calling $ua->env_proxy). CAVEAT
Note that if you are using both LWP::Simple and the very popular CGI.pm module, you may be importing a "head" function from each module, producing a warning like "Prototype mismatch: sub main::head ($) vs none". Get around this problem by just not importing LWP::Simple's "head" function, like so: use LWP::Simple qw(!head); use CGI qw(:standard); # then only CGI.pm defines a head() Then if you do need LWP::Simple's "head" function, you can just call it as "LWP::Simple::head($url)". SEE ALSO
LWP, lwpcook, LWP::UserAgent, HTTP::Status, lwp-request, lwp-mirror perl v5.16.2 2012-02-18 LWP::Simple(3)
All times are GMT -4. The time now is 07:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy