10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I am using bash and have a filename with a path and extension and want to extract just the filename
Have used the following code, oflna gives the file name with extension, but now neet to remove the .texi at the end.
oflna=${flnm##*/}
oflnb=${${flnm##*/}%.*}
echo "flnm: $flnm"
echo... (1 Reply)
Discussion started by: Danette
1 Replies
2. Shell Programming and Scripting
Hi
I would like to extract the first portion of filename from a list of files.
The filename pattern is of the form 123456789_TEXT_TEXT_TEXT_.csv. I want to extract just the numerical portion of this filename from the list of files and then output this into another text file.
K (6 Replies)
Discussion started by: kamal_p_99
6 Replies
3. Shell Programming and Scripting
Hello Everyone,
I am looking for a way to extract substrings to local variables. Here is the format of the string variable i am using :
/var/x/www && /usr/x/share/doc && /etc/x/logs
where the substrings i must extract are the "/var/x/www" and such.
I was originally thinking of using... (15 Replies)
Discussion started by: jimmy75_13
15 Replies
4. Shell Programming and Scripting
Hello all.
I can not remember the command to extract a variable from the date command.
Basically what I need to do is to store the values of date in variable and rearrange them. I can not remember the command or the syntax to do so.
so..
date
Mon Mar 8 06:57:19 GMT 2010
$1 $2 ... (12 Replies)
Discussion started by: adelsin
12 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I am a beginner in Unix so please bear with me...
I have a directory which has files in format: RECF-YYYY-MM-DD-input. For example, RECF-2008-02-25-input. I need to extract the YYYYY-MM-DD substring from this filename and convert that into date and compare it with a date. How do I do that?... (7 Replies)
Discussion started by: laiko
7 Replies
6. Shell Programming and Scripting
Hi,
I need to extract the file name without filetype.
Suppose in DIR1 if i have files like F1.txt and F2.DOC then i need to return F1 and F2 only with out file types (txt and DOC).
I tried with the following code
newname = ` $i | cut -d "'." -f1`
but it is giving the error " 0403-006... (1 Reply)
Discussion started by: Raamc
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
Any help on this would be very appreciated.
I capture the full path & filename in a variable like (varFile=/home/user/extfile.txt). Now in my shell script I have to use only the filename part i.e. extfile.txt. How do I extract only the filename part from the variable?
Thanks in... (3 Replies)
Discussion started by: njoshi
3 Replies
8. Shell Programming and Scripting
Hi Guys,
I want to extract users environment variables via a sh script, and for some reason it is not working.
According to the su man page: Example 3: Executing command with user bin's Environment and
Permissions
To execute command with the temporary environment and per-... (2 Replies)
Discussion started by: Tornado
2 Replies
9. UNIX for Dummies Questions & Answers
If I do "ls -l filename" in a script, it should return something like this:
-rw-r--r-- 1 user group 5945 Feb 28 14:24 filename
How do I put each of the above strings into a different variable?
eg Permissions, username, groupname, date (7 Replies)
Discussion started by: Sniper Pixie
7 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I have a requirement that i need to store only the filename without its extension. Can anyone please help me to do this.
For Example, i have stored the filename in a varialble called fname. I need to extract all the charecters before the first occurence of the dot.
If fname has value... (3 Replies)
Discussion started by: lotus123
3 Replies