Sponsored Content
Full Discussion: File Handling
Top Forums UNIX for Dummies Questions & Answers File Handling Post 302760955 by Yoda on Thursday 24th of January 2013 11:38:51 PM
Old 01-25-2013
Quote:
Originally Posted by Gurkamal83
I need to cut the files into multiple files of 1000 records and should have the same header and trailer as the original files.
You said that you want the same header and trailer as the original file!

By the way I missed skipping header & trailer, which you can do using awk:
Code:
lines=$( wc -l < filename )
awk -v L=$lines 'NR>1&&NR<L' filename > filename_data
split -d -l 1000 filename_data filename_out

Use wc to calculate line count and append it as trailer to each file:
Code:
head -1 filename > header

for file in filename_out*
do
   cat header ${file} > tmp
   wc -l < ${file} >> tmp
   mv tmp ${file}
done

 

10 More Discussions You Might Find Interesting

1. Programming

File Handling in C

Hi all, I have a problem in handling files through C. here is the problem im having: i will query the database (for instance consider employees table ) for empno,ename,job,salary fields.The query returns me some 100 of rows. now i need to place them in a file in row wise pattern as they... (3 Replies)
Discussion started by: trinath
3 Replies

2. Programming

file handling

Hi all, I got a little issue here. Imagine that I have more than one process accessing one file. Is it possible to know which process(es) are accessing that file when I open the file?? Thanks for the help. Best regards, Ernesto (2 Replies)
Discussion started by: ninjanesto
2 Replies

3. UNIX for Advanced & Expert Users

File Handling

Hi, I have a log file which runs into 3 to 5 GB. We store this typically for 6 months. When a new month starts we move the previous month into a 9 month back up log (file.9m) and delete the last month of the 9 month back up. Iam using awk to find the data and cat to join the files like... (3 Replies)
Discussion started by: baanprog
3 Replies

4. UNIX for Advanced & Expert Users

please help me in file handling

sir i have to get first line from a file for example >cat file1 abc zxc asd adsf from that file1 i need only first line expected result >abc please help me ! (1 Reply)
Discussion started by: ponmuthu
1 Replies

5. UNIX for Advanced & Expert Users

File handling

my input for a script is another csv file but in that file say 7 lines are there ... how can i get line by line to that input for example : >cat link.csv www.yahoo.com,yahoo www.google.com,google www.unix.com,unix another file in that file i need to ping the above links ... (2 Replies)
Discussion started by: ponmuthu
2 Replies

6. Shell Programming and Scripting

UNIX File handling -Issue in reading a file

I have been doing automation of daily check activity for a server, i have been using sqls to retrive the data and while loop for reading the data from the file for several activities. BUT i got a show stopper the below one.. where the data is getting store in $temp_file, but not being read by while... (1 Reply)
Discussion started by: KuldeepSinghTCS
1 Replies

7. Programming

Perl help for file handling

$# some text $$ some text $@ some text $$. some text Mg1 some text Mg2 some text . . . Mg10 some text The above 10 lines are to be extracted except the lines starting from $#,$$.,... (4 Replies)
Discussion started by: baig.abdul
4 Replies

8. Shell Programming and Scripting

ksh file handling

Specifically on RHEL 5.7. When does the underlying ksh process open and close files? Every time they're accessed, or as little as possible? Say you have some script like: CreateFiles() { grep "<VALUE1>" ${infile} >> ${outfile} grep "<VALUE2>" ${infile} >> ${outfile} ...... (4 Replies)
Discussion started by: CarloM
4 Replies

9. UNIX for Dummies Questions & Answers

File handling

I have a file 1 298167 298168 1093209 1093210 1422663 I want to write a code where in I want to read contents of above file like first read is 1 second read is 298167 Substract second read from first and if this is greater than or less than 99,999. Similarly I want to traverse thru... (3 Replies)
Discussion started by: Guru148
3 Replies

10. Shell Programming and Scripting

File handling

Hi All, I need to extract the data from the text file. The data of the text file is shown below #L 0.000017 4.329939 0.000017 4.716267 r7.9 P 1 1;Net=IN32 The extracted data should be IN32. Could anyone help to script in c shell.? (4 Replies)
Discussion started by: gopishrine
4 Replies
fadecut(1)						      General Commands Manual							fadecut(1)

NAME
fadecut - Toolset to rip audiostreams, cut, fade in/out and tag the resulting audiofiles SYNOPSIS
fadecut -p <profile> [ OPTIONS ] DESCRIPTION
fadecut is a script to rip audio files from a livestream (using streamripper) and to process them automatically. Beginning and ending fo the audio files will be cut and faded in/out. So logos and advertising of radio stations will be automatically removed. In streaming mode fadecut is ripping audio files using streamripper. The downloaded audio files are cutted using silence detection and then faded in and out. Subsequently, the files are encoded to either ogg or mp3 and tagged with tags (title, artist, genre and comment pro- vided). In file mode fadecut is just processing already ripped audio files. An audio file which has already been processed is detected and will not be processed again. Not desired songs can be stored in a separate directory. This files are not processed anymore too. FOLDERS
fadecut is working with some standard folders. You may change them in your profile or fadecutrc done/ here you put all your songs which were already processed by fadecut and which you want to keep. See also new/ folder. dontlike/ in this folder you may put songs which you don't like. Fadecut is checking this folder before it is processing new files in the working folder. Null size files are ok. error/ whenever an error occurs while fadecut is processing a file, that file is moved to the error folder for later examining. incomplete/ this folder is created by streamripper. All not fully ripped songs are saved here. new/ processed songs are going here. Usually you may rip and process files with fadecut, they are going in to new/ folder, you listen to them and put good songs to the done/ folder. orig/ if you want to keep the original file (which is ripped by streamripper), you may use the -k option. fadecut is putting the ripped files untouched into that folder. OPTIONS
-c Create a new profile <profilename> -e Edit an existing profile <profilename> -i optional input <directory> -o optional output <directory> -k optional to keep the untouched original song in the /orig folder -d Debug: -d 0|1|2|3 (level 0 is standard, -d without number is like 1) -h Show this message -p Profile <profilename> -q Quiet -r Stream (and rip), start streamripper -v Verbose VARIABLES
STREAM_URL="http://streamurl" test ENCODING=ogg preferred destination fileformat. (ogg/mp3) GENRE="SwissPop" Processed files will get the above genre. COMMENT="Radio Swiss Pop" Processed files will get the above comment. TRIM_BEGIN=0 cut <n> seconds off the file in the beginning. TRIM_END=0 cut <n> seconds off the file at the end. FADE_IN=1 Fade in for <n> seconds. FADE_OUT=4 Fade out for <n> seconds. EXAMPLES
Create a new ripping profile fadecut -c test Edit/update profile test fadecut -e test Rip, cut and fade in-/out with profile test fadecut -p test -r Only cut and fade in-/out without ripping from livestream fadecut -p test SEE ALSO
id3v2(1), oggenc(1), sox(1), streamripper(1), lame(1) FILES
~/.fadecut/fadecutrc The main fadecut configuration file, executed with every start of fadecut ~/.fadecut/statslog.csv The statistics file ~/.fadecut/profiles The folder where all profiles are located RESOURCES
fadecut git website https://github.com/micressor/fadecut 0.1.0 fadecut(1)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy