Sponsored Content
Full Discussion: Seperating Files
Top Forums UNIX for Dummies Questions & Answers Seperating Files Post 13348 by biglemon on Wednesday 16th of January 2002 02:10:07 AM
Old 01-16-2002
Question

i'm a self-learning new UNIX user
i'm writing my 3rd UNIX script in my life...
but i found myself fall into syndex errors...
this script is use for seperate file from a ftp server...
i need to cut it small into 1000 lines each
with keeping the first and last line of the original file in each new file
All the Files in xyz12345.txt with cuts into xyz2345a.txt , xyz2345b.txt ...etc
the line number will be rearranged from 001,...999.

Code:
#! /bin/ksh
for filename in *
do
	nline=wc -l $filename
	if [$nline -gt 1000] 
	then
		headLine= `head -1 $filename`
		tailLine= `tail -1 $filename`
		endCode= `abcdefghijklmnopqrstuvwxyz`
		counter= 1
		countLine= 2
		# For initialization before the first running of the while loop
		newFileName=`echo $filename| cut -c1-3,5-8``echo $endCode | cut -c$counter``echo $filename| cut -c9-12`
		echo $headLine > $newFileName
		
		while [$countLine -le $nline]
		do
			newFileName=`echo $filename| cut -c1-3,5-8``echo $endCode | cut -c$counter``echo $filename| cut -c9-12`
		
			typeset -Z3 headVar=0 ## no typeset in SCO?!
			echo ${headVar} 
			headVar=`expr $headVar + 1` 
			echo $headVar`head -$countLine filename | tail -1 | cut -c4- ` >> newFileName
			newFileNoLine= wc -l newFileName
			if [$newFileNoLine -eq 999] 
			then
				echo $tailLine >> newFileName
				counter=`expr $counter +1`
				headVar= 1
			fi
		done
	fi
done

hope ano can point out my mistakes and my misunderstanding. BIG THANKS

Last edited by biglemon; 01-16-2002 at 03:32 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

seperating the words from a line??

The line is like this +abc+def+mgh+ddsdsd+sa i.e. words seperated by +. There is a plus in the beginning. i want to conver this line to abc, def, mgh, ddsdsd, sa please provide the logic in the form of a shell script Thanks in advance (3 Replies)
Discussion started by: skyineyes
3 Replies

2. Shell Programming and Scripting

Seperating one word into columns

Hi, Our issue is that we want to separate a string of characters, like xyxyxyxxxxyyxyxy into a column, x y x y ... I'm sure there's an easy awk fix for this, but being inexperienced, I figured I would ask on here. Thanks a lot in advance! (4 Replies)
Discussion started by: NovaGhostii
4 Replies

3. UNIX for Dummies Questions & Answers

seperating records with numbers from a set of numbers

I have two files one (numbers file)contains the numbers(approximately 30000) and the other file(record file) contains the records(approximately 40000)which may or may not contain the numbers from that file. I want to seperate the records which has the field 1=(any of the number from numbers... (15 Replies)
Discussion started by: Shiv@jad
15 Replies

4. Shell Programming and Scripting

How to retrieve all the linked script files/ctl files/sql files?

Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux. Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)
Discussion started by: franksubramania
1 Replies

5. Shell Programming and Scripting

How to extract data from indexed files (ISAM files) maintained in an unix server.

Hi, Could someone please assist on a quick way of How to extract data from indexed files (ISAM files) maintained in an UNIX(AIX) server.The file data needs to be extracted in flat text file or CSV or excel format . Usually we have programs in microfocus COBOL to extract data, but would like... (2 Replies)
Discussion started by: devina
2 Replies

6. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

7. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

8. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

9. UNIX for Beginners Questions & Answers

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
ALE(1)																	    ALE(1)

NAME
ale - a synthetic capture engine and renderer SYNOPSIS
ale [OPTIONS] original-frame [supplemental-frames ...] output-file ale [HELP OPTIONS] ale --version DESCRIPTION
ALE is a free software synthetic capture engine and renderer accepting, as input, a sequence of image frames, and producing, as output, rendered images, registration data, and 3D models (currently experimental). EXAMPLES
ale --hu Print the help page on program usage. ale 001.ppm 002.ppm 003.ppm out.ppm Render output file out.ppm from inputs 001.ppm, 002.ppm, and 003.ppm. ale --scale 2 001.ppm 002.ppm 003.ppm out.png Render output file out.png at 2x scale. ale --perturb-upper=0 --trans-load=a.t --projective frame*.png out.png Render output file out.png from inputs frame*.png, using projective transformations as described in the file a.t. ale --3dv 0 out.png --projective frame*.png null: Render output file out.png from inputs frame*.png, using a 3D scene model to determine transformations. ale --visp last:sinc*lanc:6 sf:0 out/ .jpg in/*.jpg null: Render a video stream from files in/*.jpg to the directory out/, stabilizing to the first frame, with a lanczos-windowed sinc filter. USAGE
ale is a wrapper script that calls the executable ale-bin after extracting exposure EXIF information from image files (when the exiftool utility is available) and converting from raw formats (when the dcraw utility is available). When ale-bin has been linked with ImageMagick, input and output files may be of any kind supported by ImageMagick. Otherwise, only PPM files can be read and written by ale-bin. OPTIONS
OPTIONS are summarized via built-in help pages (see HELP OPTIONS below). More detailed manuals describing options and internal algorithms are available for certain versions of ALE. See SEE ALSO below for more details on other manuals. HELP OPTIONS
A listing of available help options can be obtained by invoking ale --hu. ENVIRONMENT
The wrapper script ale recognizes the following environment variables: ALE_BIN ALE executable to use. DCRAW dcraw raw extraction tool to use. EXIF_UTILITY EXIF extraction utility to use. ALE_COUNT_THREADS Displays statistics on thread counts when set to a non-zero value. PAGER Text pager to use (e.g., for displaying help pages). SEE ALSO
More detailed manuals for certain versions of ALE are distributed with source packages, and may also be available from: http://auricle.dyndns.org/ALE/manuals/ 03/31/2009 ALE(1)
All times are GMT -4. The time now is 03:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy