If you state that _ and - are word separators and you want the first 5 words from the string contained in a variable; no your code cannot reliably guess at how many separators in the first 5 words are not separators.
If you know that the part of the filename that you do not want always ends with three occurrences of _string, you could use:
with any shell that performs the variable expansions required by the POSIX standards.
Note also that there is a huge difference between using the command name echo and the command name Echo in any system that conforms to the standards. Utility names are case sensitive and there is no definition in the standards as to what a command named Echo will do (if such a command exists on your system).
Also note that there is no need to use echo and command substitution in the assignment of the variable expansion.
Last edited by Don Cragun; 04-09-2018 at 07:53 AM..
Reason: Add second note.
Hi,
I want to display only the file names of the ls command with a delimiter of comma.
For example:-
ls /etc/dir/N*
gives the following output
/etc/dir/N1 /etc/dir/N2 /etc/dir/N3
I want the output as N1,N2,N3,-->Here i need the final comma also.
Also, here /etc/dir is being... (2 Replies)
"355"|""|"NJ"|"A0A 1W0"|"V"|""|""|""|"N"
I've the above sample data seperated with pipe delimeter and in the file I want to replace a space with "|" to the 4th field so the result would be like below. So it would change from 9 fields to 10 fields.
"355"|""|"NJ"|"A0A"|"1W0"|"V"|""|""|""|"N"
... (3 Replies)
Hi.,
My file name is of the format:
name_abc_20100531_142528.txt
where.,
my timestamp is of the format:
yyyymmdd_hhmmss
How to extract the date strring and time string into seperate variables in the shell script, after reading the file as the input?
I want to get the variables... (9 Replies)
I am trying to find a way to create a script which will extract the first line of a file and then rename the file (or create a new file with the same content as the old file) using the first line as the name. The first line being a single word, that is. I am hopeless at programming, if anyone can... (5 Replies)
Hi, i have a filename CRED20102009.txt in a server
20102009 is the date of the file ddmmaaaa format
the complete route is
/dprod/informatica/Fuentes/CRED20102009.csv
i want to extract the date to create a new file named Parameters.txt
I need to create Parameters.txt with this... (6 Replies)
Hi,
Here is my question: suppose I have files like
1990_8xdaily_atmos.nc
1991_8xdaily_atmos.nc
1992_8xdaily_atmos.nc
1993_8xdaily_atmos.nc
1990_daily_atmos.nc
1991_daily_atmos.nc
1992_daily_atmos.nc
1993_daily_atmos.nc
1990_month_atmos.nc
1991_month_atmos.nc
1992_month_atmos.nc... (1 Reply)
Hi All,
Thanks in Advance
I am working on a shell script. I need some assistance.
My Requirement:
1) There are some set of files in a directory like given below
OTP_UFSC_20120530000000_acc.csv
OTP_UFSC_20120530000000_faf.csv
OTP_UFSC_20120530000000_prom.csv... (0 Replies)
Hi All,
Thanks in Advance
I am working on a shell script. I need some assistance.
My code:
if
then
set "subscriber" "promplan" "mapping" "dedicatedaccount" "faflistSub" "faflistAcc" "accumulator"\
"pam_account";
for i in 1 2 3 4 5 6 7 8;... (0 Replies)
Hi
I need to extract the string from file name
filename: FILENAME_STRUT_01032013_XXXXXXX.TXT
I want 01032013 from the above file name. number of characters may differ before the required string but underscores(-) are same number i.e. after second underscore.
Please advise on this.
... (2 Replies)
Hello experts, I want to join a file with files whosE names are mentioned in one of the columns of the same file.
File 1
t1,a,b,file number 1
t1,a,c,file number 1
t2,c,d,file number 2
t2,c,e,file number 2
t2,c,f,file number 2
t2,c,g,file number 2
t3,e,f,file number 3
file number 1... (3 Replies)
Discussion started by: ritakadm
3 Replies
LEARN ABOUT DEBIAN
gextractwinicons
GEXTRACTWINICONS(1) General Commands Manual GEXTRACTWINICONS(1)NAME
gExtractWinIcons - Extract cursors and icons from MS Windows compatible resource files
SYNOPSIS
gextractwinicons -h
gextractwinicons [options]
DESCRIPTION
gExtractWinIcons is a GTK+ utility to extract cursors, icons and png images from MS Windows compatible resource files (.exe, .dll, .ocx,
.cpl and many others).
To extract icons or cursors just to select a MS Windows compatible resource file and the contained resources will be shown. Select a desti-
nation directory where to save the selected resources, simply check the items to extract and press the save button to save them in the
specified path.
OPTIONS
This program follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included
below.
-h, --help
Show summary of options
-d, --destination
Set destination folder for extracted resources
-f, --filename
Set resources filename from which to extract the resources
-r, --refresh
Automatically refresh the resources list if -f (--filename) was specified
AUTHORS
gExtractWinIcons was written by Fabio Castelli <muflone@vbsimple.net>.
HOMEPAGE
http://code.google.com/p/gextractwinicons/
January 3, 2010 GEXTRACTWINICONS(1)