head

Unix shell: how to get the last lines of a file except the first 20?

Say I have a file with any number of lines, say, 125. I want to get all the lines except the first n, say, 20. So, I want lines 21-125. Is there a way to do this with with tail/head, or some other tool? ...

How to send a HEAD HTTP request in Python to Amazon S3?

I'm trying to retrieve HTTP HEAD information from a S3 resource using Python. Unfortunately the response always returns a 403 error. I am using code that was suggested here but unfortunately this does not work for S3 requests. Here is the code (host and key details omitted): >>> import httplib >>> conn = httplib.HTTPConnection("www.myb...

Applying Unix's Head on AWK Through Find Command

I want to output top 10 lines of AWK command in the list of files given by find, using this snippet: $ find . -name "*.txt" -print -exec awk '$9 != ""' \| head -n10 {} \; Note also that I want to print out the file names being processed. But why I get such error: awk: cmd. line:2: fatal: cannot open file `|' for reading (No such fi...

How to pipe a command result to a -<character><argument> option? (Without spaces)

Hello! I have this set of piped commands: grep -n '*' file.txt | head -n1 | awk -F\: '{print $1-1;}' It tells me the previous line to that where it first find asterisks. Now I want to get the previous lines piping that to: head -n<that previous line number> Head requires a number following immediately the -n argument, without space...

Value of the last element of a list

Hi, how to get the value of the last element of a List? I've noted that List.hd (or .Head) return an item, while List.tl (or .Tail) returns a List. Is rev the List and get the hd the only way around? Thanks. ...

Does <STYLE> have to be in the <HEAD> of an HTML document?

Strictly speaking, do style tags need to be inside the head of an HTML document? The 4.01 standard implies that, but it's not explicitly stated: The STYLE element allows authors to put style sheet rules in the head of the document. HTML permits any number of STYLE elements in the HEAD section of a document. I say "strictly ...

Understanding a sentence about starting up jQuery

What is the definition of entire page in the following line? When the entire page is included via PHP include() or require() function, make sure to put that script code inside the <body> tag and not inside the <head>, because calling jQuery script file from inside the tag doesn't work for some reason. I have had proble...

Is header('Content-Type:text/plain'); necessary at all?

I didn't see any difference with or without this head information yet. ...

line of bash code from .configure file

I need to understand the following line of code: BIN_DIR=`grep BIN_DIR= $SMLCM | head -1` where $SMLCH contains a path This is what I understood so far: grep will produce some string(s), possible paths. What does grep do with BIN_DIR=? the pathes are passed to head and all files within the paths will be used to extract their first ...

Is there a way, using jQuery, to change the document.title after the page has loaded?

I have coded myself into a corner. Does anyone know the answer? Thanks! ...

What is the easiest way to use the HEAD command of HTTP in PHP?

I would like to send the HEAD command of the Hypertext Transfer Protocol to a server in PHP to retrieve the header, but not the content or a URL. How do I do this in an efficient way? The probably most common use-case is to check for dead web links. For this I only need the reply code of the HTTP request and not the page content. Gettin...

Why does Amazon put their CSS in the Head tag?

Okay, what is Amazon doing? They put all their CSS definitions in the <head> tag? I can see the purpose of saving requests, but it doesn't seem very dynamic to me. Any ideas? ...

How to output lines 800-900 of a file with a unix command?

I want to output all lines between a and b in a file. This works but seems like overkill: head -n 900 file.txt | tail -n 100 My lack of unix knowledge seems to be the limit here. Any suggestions? ...

Read first N lines of a file in python

We have a large raw data file that we would like to trim to a specified size. I am experienced in .net c#, however would like to do this in python to simplify things and out of interest. How would I go about getting the first N lines of a text file in python? Will the OS being used have any effect on the implementation? Thanks :) ...

getting the HEAD element from overlay.js firefox plugin

I have a lightwiehgt plugin to firefox which needs to inject a script into the HTML. The code looks like this: var head = document.getElementsByTagName("head")[0]; var newscrpt; newscrpt = document.createElement('script'); newscrpt.type = "text/javascript" ; newscrpt.src = "http://blabla.com/..."; newscrpt = head.appendChild(news...

Checking if a website is up via Python

By using python, how can I check if a website is up? From what I read, I need to check the "HTTP HEAD" and see status code "200 OK", but how to do so ? Cheers Related How do you send a HEAD HTTP request in Python? ...

How do I send a HEAD request manually using Firefox?

I'm debugging my webserver, and I'd like to manually send HEAD requests to some web pages. Is there a way to do this in Firefox? Some extension perhaps. I want to use firefox so that it can be part of a normal session (ie cookies set, logged in, etc). So things like curl aren't perfect. ...

Best practice for handling HTTP HEAD request with Django on App Engine

I'm receiving HEAD requests in my application, and wondering on the best way to handle them. Options are: convert them to GETs, process GET normally, then: strip the body (though I'm not sure how - response.content = '' doesn't seem to do it. it seems app engine auto-strips the body, giving a warning "Dropping unexpected body in respo...

Git svn fetch retrieving only one revision at a time

I'm using Git-1.6.5.1-preview20091022.exe. I've cloned a SubVersion repository using: git svn clone -s https://xxxxx:8443/svn/project/SubProjectA The SubProjectA has the standard layout (trunk, branches, tags). SubProjectA is a copy of another project. It has only 60 revisions if it own. After the command, a folder is created with th...

How to replace entire CSS of a page after an ajax request with jQuery?

I have a document with one CSS linked in. How can I replace the current CSS with one coming from a document that I just fetched with AJAX request using jQuery? Here's the code I am trying right now, but with no success so far: $(function() { $.get('next_page.html', function(data, textStatus) { $('link[rel=stylesheet]:first'...