the last "_" underscore is before the extension. therefore you can use % which means "shortest match from the back"
please read again Advance Bash guide (google) for details on string manipulation
-rw-r--r-- 1 fxpbftp fusion 368 Jun 10 08:34 FX_1.11840235236594E12.111234236809956
If I have a long list of files that look like this (they al begni with FX_1.#######.####) Sometimes, there may be less numbers or more in the filename, that varies.
I wish to isolate just the... (8 Replies)
I have contents like
423562143124/53125351276
sdgas/347236
sjhdk;ls'ald/y62783612763
I need a command that would make the string before / and after / as separate output as (A should contain 423562143124 )and B should
contain 53125351276).
I tried but in vain.
Please help. (19 Replies)
Using a ksh script, I'm dumping the data from our sybase database into an output file. This output file is for what ever reason cut at 2GB.
There is enough space on the unix machine and as there is no error message is received I have no clue to start looking for a solution.
#!... (1 Reply)
Hi,
I have:
export string1=qwerWhatever
export string2=qwerWhatever1
export currdir=`pwd`
echo $currdir gives back:
/dir/dir/Whatever1
I want to take first 4 letters from string1 (in this case: qwer), compare it to string2 (in this case qwerWhatever1) and if string2 has in it... (8 Replies)
I need a small script (sh) to remove in a variable the filename extension.
Example:
f = "testfile.txt"
and I need a $a with "testfile".
Some one a idea? (4 Replies)
Hi All,
I have the file & name is "/a/b/c/d/e/xyz.dat"
I need "/a/b/c/d/e/" from the above file name.
I tryning with echo and awk. But it not come. Please help me in this regard.
Thanks & Regards,
Dathu (3 Replies)
Hi all.. I have several unique files that contain one thing in common, and that is acct#. For all files in the directory, I want to append the 10 characters following the word "ACCOUNT:" to the end of the filename.
for example:
I have file 111_123 that contains ACCOUNT:ABC1234567
The file... (5 Replies)
Hi ,
I've the following file names and i need the part of the file name
The files are like below
FN_DATE_TODAY_20010178654321.txt
FN_DATE_LASTDAY_19990178654321.txt
and i need to cut the filenames like below
FN_DATE_TODAY
FN_DATE_LASTDAY
How can i achieve that
Thanks (5 Replies)
Hi,
I need a script which do below
I have a filename: TEST2013_09_17_XX_XX_XX.csv
Now script should create a new file with name: XX_XX_XX.csv
Or I should say i need the output as XX_XX_XX.csv
Please help. Mant thanks in advance (3 Replies)
I have this filename "RBD_EXTRACT_a3468_d20131118.tar.gz" and I would like print out the "yyyymmdd" only. I use this command below, but if different command like cut or print....etc. Thanks
ls RBD_EXTRACT* | sed 's/.*\(........\).tar.gz$/\1/' > test.txt (9 Replies)
Discussion started by: dotran
9 Replies
LEARN ABOUT CENTOS
zip_fopen
ZIP_FOPEN(3) Library Functions Manual ZIP_FOPEN(3)NAME
zip_fopen , - .Nm zip_fopen_index open file in zip archive for reading
LIBRARY
libzip (-lzip)
SYNOPSIS
#include <zip.h>
struct zip_file * zip_fopen(struct zip *archive, const char *fname, int flags);
struct zip_file * zip_fopen_index(struct zip *archive, zip_uint64_t index, int flags);
DESCRIPTION
The zip_fopen function opens the file name fname in archive. The flags argument specifies how the name lookup should be done, according to
the values are described in zip_name_locate(3). Also, the following values may be or'ed to it.
ZIP_FL_COMPRESSED Read the compressed data. Otherwise the data is uncompressed by zip_fread.
ZIP_FL_UNCHANGED Read the original data from the zip archive, ignoring any changes made to the file.
The zip_fopen_index function opens the file at position index.
If encrypted data is encountered, the functions call zip_fopen_encrypted(3) or zip_fopen_index_encrypted(3) respectively, using the default
password set with zip_set_default_password(3).
RETURN VALUES
Upon successful completion, a
struct zip_file pointer is returned. Otherwise, NULL is returned and the error code in archive is set to indicate the error.
ERRORS
[ZIP_ER_CHANGED]
The file data has been changed.
[ZIP_ER_COMPNOTSUPP]
The compression method used is not supported.
[ZIP_ER_ENCRNOTSUPP]
The encryption method used is not supported.
[ZIP_ER_MEMORY]
Required memory could not be allocated.
[ZIP_ER_READ]
A file read error occurred.
[ZIP_ER_SEEK]
A file seek error occurred.
[ZIP_ER_ZLIB]
Initializing the zlib stream failed.
The function zip_fopen may also fail and set for any of the errors specified for the routine zip_name_locate(3).
The function zip_fopen_index may also fail with ZIP_ER_INVAL if index is invalid.
SEE ALSO libzip(3), zip_fclose(3), zip_fread(3), zip_get_num_entries(3), zip_name_locate(3), zip_set_default_password(3)AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at>
NiH February 14, 2011 ZIP_FOPEN(3)