The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SED: Update Last Line with Number Lines in File bmkux Shell Programming and Scripting 3 01-07-2008 10:16 PM
How to find number of lines in a file somesh_p Shell Programming and Scripting 2 12-19-2007 09:15 PM
total number of lines in a file Raynon Shell Programming and Scripting 9 10-04-2007 09:13 AM
Need ls to show number of lines in each file GMMike UNIX for Dummies Questions & Answers 1 11-19-2004 05:53 AM
Counting the number of lines in ASCII file alarmcall Shell Programming and Scripting 8 08-26-2003 06:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-08-2005
networkfre@k networkfre@k is offline
Registered User
  
 

Join Date: Aug 2004
Location: standing in a Sun 25k, Vienna
Posts: 78
cut a number of lines out of a file

Hi,

I have a text file contaning around 150 lines, each line is a hostname.
I want to read 4 lines/hostnames and save those 4 lines to a seperate file.
say the big file is /files/bigfile and I want to have a lot of files in /files named
/files/smallfile.1 , /files/smallfile.2 and so on...

I have no idea how to do this

Thanks
  #2 (permalink)  
Old 12-09-2005
futurelet futurelet is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 137
Code:
awk '{print >("smallfile" int((NR+3)/4))}' bigfile
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0