Sponsored Content
Top Forums Shell Programming and Scripting Help on Spliting files - urgent Post 302173595 by aajan on Friday 7th of March 2008 06:37:55 AM
Old 03-07-2008
Hope this should work!!!!!!!!!!

#!/usr/bin/ksh
i=1
j=0
k=0
cat samp | while read line
do
if [ $line -lt 100 ]
then
arr[$i]=$line
if [ $j -le 5 ]
then
echo ${arr[$i]}
echo ${arr[$i]} >> aa$k.txt
i=`expr $i + 1`
j=`expr $j + 1`
fi
if [ $j -eq 5 ]
then
j=0
k=`expr $k + 1`
fi
fi
done

The above script wil split the files for two-digit numbers..
And you complete the rest..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

spliting up sentences

hello, i'm looking to split up text into a list of words but can't figure it out, any help would be great. thanks steven (2 Replies)
Discussion started by: stevox
2 Replies

2. Shell Programming and Scripting

spliting variable value

Hi, I am reading two values from oracle to unix variable and spliting them using the read command as follows, get_details=`sqlplus -s $sld_user/$sld_password@$sld_string<<EOF whenever sqlerror exit 1 whenever oserror exit 1 set feedback off set heading off set pagesize... (0 Replies)
Discussion started by: harsh_kats
0 Replies

3. Shell Programming and Scripting

spliting 4gb files to 4*1 gb each

I have log file whose size is 4 GB , i would like to split it to 1 gb each ,Can any one tell me the syntax of csplit comand for that. I am using Sun0S 5.8 (3 Replies)
Discussion started by: jambesh
3 Replies

4. Shell Programming and Scripting

Spliting the file dynamically

i am creating the file , when this file reaches the size 2 GB, i need one message or fire (4 Replies)
Discussion started by: kingganesh04
4 Replies

5. UNIX for Dummies Questions & Answers

spliting a file

how would i split the file "file1" into smaller files containg lines of 15 (1 Reply)
Discussion started by: JamieMurry
1 Replies

6. Shell Programming and Scripting

spliting up a large file

Dear All, I have a very large file which which i would like split into indvidual frames evrytime the line ends with "ENDMDL" and then name frame1.pdb frame2.pdb etc can any one give me a few sugeestions? ideally i would like to have ENDMDL at the end of each frame or not pressent at all. an... (4 Replies)
Discussion started by: Mish_99
4 Replies

7. UNIX for Dummies Questions & Answers

Spliting of two files

hi I have a log file which contains some reports. The log file looks like this:- STARTOFREPORT /tmp file1.txt some text to be folowd ENDOFREPORT some non utilized characters STARTOFREPORT /log file2.txt more text (3 Replies)
Discussion started by: infyanurag
3 Replies

8. UNIX for Dummies Questions & Answers

Zipping files - Please help me its urgent

Dear all, I have thousands of log files in my log directory which I need to zip them and archive. I tried using zip command. But it is not allowing me to archive it more that 4GB of file size. So how to archive them. If it is not possible how to zip all files in to multiple archive files which... (3 Replies)
Discussion started by: tvbhkishore
3 Replies

9. Shell Programming and Scripting

Spliting log file

Hello, I want to split or cut a large size log file by year wise(eg 2009, 2010) .But the source file must not have the splited or cut lines after this process ,all of them must move to the destination folder.Does grep command have the fuctionality like cut and paste? I used grep -Ev command but... (17 Replies)
Discussion started by: jobycxa
17 Replies

10. Shell Programming and Scripting

XML spliting

hi, Am able to split an XML file by using follwing awk command, awk 'NR==1{x=$0;next}/<\/Order>/{print y RS $0 RS "</Order>">f}/Order BillToKey/{f="file"++n".xml";y=x}{y=y RS $0}' filename.xml but i need to insert a following tag in the begining of every file how to do so. The tag is as... (7 Replies)
Discussion started by: mitnix
7 Replies
UNSHAR(1)						      General Commands Manual							 UNSHAR(1)

NAME
unshar - unpack a shar file SYNOPSIS
unshar [ options ] [ file ... ] DESCRIPTION
Unshar scans mail messages looking for the start of a shell archive. It then passes the archive through a copy of the shell to unpack it. It will accept multiple files. If no files are given, standard input is used. OPTIONS
Options have a one letter version starting with - or a long version starting with --. The exception is --help and --version, which does not have a short version. --version Print the version number of the program on standard output, then immediately exits. --help Print a help summary on standard output, then immediately exits. -d DIRECTORY --directory=DIRECTORY Change directory to DIRECTORY before unpacking any files. -c --overwrite Passed as an option to the shar file. Many shell archive scripts (including those produced by `shar' 3.40 and newer) accepts a -c argument to indicate that existing files should be overwritten. -e --exit-0 This option exists mainly for people who collect many shell archives into a single mail folder. With this option, `unshar' isolates each different shell archive from the others which have been put in the same file, unpacking each in turn, from the beginning of the file towards its end. Its proper operation relies on the fact that many shar files are terminated by a `exit 0' at the beginning of a line. Option -e is internally equivalent to -E "exit 0". -E STRING --split-at=STRING This option works like -e, but it allows you to specify the string that separates archives if `exit 0' isn't appropriate. For example, noticing that most `.signatures' have a `--' on a line right before them, one can sometimes use `--split-at=--' for splitting shell archives which lack the `exit 0' line at end. The signature will then be skipped altogether with the headers of the following message. -f --force The same as -c. SEE ALSO
shar(1) DIAGNOSTICS
Any message from the shell may be displayed. AUTHORS
The shar and unshar programs is the collective work of many authors. Many people contributed by reporting problems, suggesting various improvements or submitting actual code. A list of these people is in the THANKS file in the sharutils distribution. September 10, 1995 UNSHAR(1)
All times are GMT -4. The time now is 04:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy