Help using head cmd, print 20 then the next 20 etc

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help using head cmd, print 20 then the next 20 etc
# 1  
Error [solved] Help using head cmd, print 20 then the next 20 etc

Hi all,

I have a list of text, single column and I want to print the first 20, then the second 20 and so on. I was pointed to xarg to help with this, but can't get my head around how to use it.

Would be great if it would put them into separate files with a certain name.

Any suggestions would be greatly appreciated.

---------- Post updated at 05:05 PM ---------- Previous update was at 05:00 PM ----------

I've just found that split does what I need it to do.
split -l 10 file.txt

# 2  
Unsure fo your request

The 'more' command displays a screenful of data. And there are options to control how much data, or how many lines.
The 'head' command will display the first x number of lines. There are options to start at a particular line number.

You need to proved more info and samples.
This User Gave Thanks to joeyg For This Post:
# 3  
Basically, I had 400 and odd lines of short text. I wanted to split these lines into multiple files that each contained 20 unique lines that were take sequentially from the original file.

Split has done this for me easily, just wasn't aware of it.

Don't know if I can mark this thread as solved or not.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #171
Difficulty: Medium
IBM acquired Red Hat for $34 billion USD.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scratching my head over old post

Hello ! Pondering over some old post & I need some help. Here is the link below - When I run this, echo " process(130) Deleting Text on line 11 (ESN:27723211621B01DJ68AG) because a number... (2 Replies)
Discussion started by: OMLEELA
2 Replies

2. Shell Programming and Scripting

Cmd="grep 'Name:' |awk -F' ' '{print $2}'"

Hi Is it possible to get the below code working.? cmd="grep 'Name:' |awk -F' ' '{print $2}'|xargs -i basename {}" echo $cmd ( rman target / <<EOF1 LIST COPY ; exit EOF1 ) | `$cmd` in nutshell I want to be able to preset cmd as depending on script flow it can be... (2 Replies)
Discussion started by: zam
2 Replies

3. Shell Programming and Scripting

Perl open(CMD, "cmd |"); buffering problem..

Hello, There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it? open(CMD,... (2 Replies)
Discussion started by: Shawn, Lee
2 Replies

4. Shell Programming and Scripting

Unix cmd prompt how to get old cmd run?

Hi, I am using SunOS I want to serch my previous command from unix prompt (like on AIX we can search by ESC -k) how to get in SunOs urgent help require. (10 Replies)
Discussion started by: RahulJoshi
10 Replies

5. UNIX for Dummies Questions & Answers

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 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 ? ----------... (1 Reply)
Discussion started by: tjmannonline
1 Replies

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

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

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

man <cmd> >> cmd.txt

I've noticed most of my postings here are because of syntax errors. So I want to begin compiling a large txt file that contains all the "man <cmd>" of the commands I most have problems with. I ran a "man nawk >> nawk.txt" but it included a header/footer on each "page". Anyone know how I'd be... (6 Replies)
Discussion started by: yongho
6 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

Featured Tech Videos