![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Shell Programming and Scripting | nivas | Shell Programming and Scripting | 20 | 02-27-2008 06:36 AM |
| Shell Programming and Scripting | nivas | Shell Programming and Scripting | 21 | 02-25-2008 06:27 AM |
| Shell Programming and Scripting | nivas | Shell Programming and Scripting | 2 | 02-20-2008 02:59 AM |
| Shell Programming and Scripting | nivas | Shell Programming and Scripting | 3 | 02-13-2008 08:10 AM |
| Shell scripting & programming languages | aloysius1001 | UNIX Desktop for Dummies Questions & Answers | 1 | 02-19-2002 12:04 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shell Programming and Scripting
Hi,
iam having the file as follows: ABCDEFGH|0987654321234567 ABCDEFGH|0987654321234523 ABCDEFGH|0987654321234556 ABCDEFGH|0987654321234545 POIUYTRE|1234567890890678 POIUYTRE|1209867757352567 POIUYTRE|5463879088797131 POIUYTRE|5468980091344456 pls provide me the split command I want to split this abouve file as per the 1-8 character. o/p file should file1 ABCDEFGH|0987654321234567 ABCDEFGH|0987654321234523 ABCDEFGH|0987654321234556 ABCDEFGH|0987654321234545 file2 POIUYTRE|1234567890890678 POIUYTRE|1209867757352567 POIUYTRE|5463879088797131 POIUYTRE|5468980091344456 |
|
||||
|
split -l is the best options, do a man on split and read the -l option.
The following options are supported: -linecount | -l linecount Number of lines in each piece. Defaults to 1000 lines. 1) wc filename ( one you know the total # of lines you can decide on splitting them in either 2 or 2 or n number of smaller files. For example if your file has 100000 lines split -l 50000 filename will give you two file xaa and xab with 50000 lines each. if you do split -l 20000 filename it will give you xaa, xab , xac, xad, xae files with exactly 20000 lines in each file. I hope this helps. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|