Instead of invoking grep twice and sed once for each file to be processed, one might also consider just using ed:
Note that this will skip files with names ending with _1.txt and that it will put all To: lines first in the output, followed by all Date: lines, followed by all Subject: lines (each of the above with the keywords removed), followed by the remaining lines in the original file. If you know beforehand that there will never be more than one of the header lines of each of the three header line types, this code could be further simplified.
Note that the above code uses tabs (not spaces) to indent lines. If you convert those tabs to spaces, the shell won't find the end of the here-document.
Note also that this code uses:
which just prints the command to remove the old files. If, after testing, you find that the code does what you want; remove the echo to actually remove the old files.
This User Gave Thanks to Don Cragun For This Post:
Hi,
I have a requirement where
I need to move Bunch of folders containing multiple files to another archive location.
i want to use mv command .I am thinking when we use mv command to move directory does it create directory 1st and then move all the files ?
e.g
source... (4 Replies)
I am trying to grab a folder and all the folders and files underneath it and send it from one computer to another. I basically want to compress the whole folder into a tar, tgz, or zip file so that it can be sent as one file. is there a command to compress a folder and all its contents into a tar... (7 Replies)
Hi All,
I am using the awk command to replace ',' by '\t' (tabs) in a csv file. I would like to apply this to all .csv files in a directory and create .txt files with the tabs.
How would I do this in a script?
I have the following script called "csvtabs":
awk 'BEGIN {
FS... (4 Replies)
Hi there
how to create a command in csh that would print files only from 1 folder but as an argument takes home directory for e.g. in my home diecrtory I have 3 folders unix, windows,mac and alot of files. and I running the program as ./op ~
this should return me files from unix folder without... (1 Reply)
Hey gyuz,
I wanna calculate the number of mapped reads of a bam file in a region of interest. I used this code to do so :
samtools view input.bam chrname:region1 > region1.txt
This will store all the reads from given bam file within the region of interest in region1.txt
Now I have... (5 Replies)
Hi All,
<Re-posting in Correct group>
I'm trying to select all the files in a folder that starts with a particular name format and are created in a gven date range using 'ls' command...but i'm not successful....
Example : I'm trying to see all the text files in a folder who names start... (6 Replies)
Hi ,
I've learnt that the following command will remove the files from the given folder for given no.of days
find /home/etc -type f -atime -10 -exec rm -f {} \;
But how can I change the above command that will move the files to another specified directory instead of removing the... (1 Reply)
Dear folks
I have two data set which there names are "final.map" and "1.geno" and look like this structures:
final.map:
gi|358485511|ref|NC_006088.3| 2044
gi|358485511|ref|NC_006088.3| 2048
gi|358485511|ref|NC_006088.3| 2187
gi|358485511|ref|NC_006088.3| 17654
... (2 Replies)
Hi, I'd like to loop an action over all files with given extension within a folder.
The "main" action is: awk -F "\t" 'BEGIN{OFS="\t"}{if ($10=="S") print$0; }' input.txt > output.txt
The input.txt should be every file in the folder with *.subVCF extension; and the output should be a file... (3 Replies)
Discussion started by: dovah
3 Replies
LEARN ABOUT DEBIAN
zip_source_file
ZIP_SOURCE_FILE(3) Library Functions Manual ZIP_SOURCE_FILE(3)NAME
zip_source_file - create data source from a file
LIBRARY
libzip (-lzip)
SYNOPSIS
struct zip_source * zip_source_file(struct zip *archive, const char *fname); "zip_uint64_t start" "zip_int64_t len"
DESCRIPTION
The function zip_source_file creates a zip source from a file. zip_source_file opens fname and reads len bytes from offset start from it.
If len is 0 or -1, the whole file (starting from start ) is used.
The fie is opened and read when the data from the source is used, usually by zip_close.
RETURN VALUES
Upon successful completion, the created source is returned. Otherwise, NULL is returned and the error code in archive is set to indicate
the error.
ERRORS
zip_source_file fails if:
[ZIP_ER_INVAL]
fname, start, or len are invalid.
[ZIP_ER_MEMORY]
Required memory could not be allocated.
[ZIP_ER_OPEN]
Opening fname failed.
SEE ALSO libzip(3), zip_add(3), zip_replace(3), zip_source_buffer(3), zip_source_filep(3), zip_source_free(3), zip_source_function(3),
zip_source_zip(3)AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at>
NiH August 1, 2008 ZIP_SOURCE_FILE(3)