I am writing an ebuild for Gentoo Linux operating system.
Writing an ebuild is about Bash scripting where I am a newbie.
So, my ebuild must find a part of a specific filename.
Such a filaname my look like this:
and I must to find the number at the and of filename, which is in this case 740.
This number will change with time ( eg. it was a few days ago 734 ) so my ebuild must find it to works properly.
If I can to find this part of filename, then I can to store it into a variable which can then use further in the ebuild script.
The file path is known for my ebuild script but the filename can change, but only that number at the end of filename.
How can I find that part of the filename?
Best, Pál
Last edited by csanyipal; 08-21-2017 at 09:06 AM..
It works,
gives
But what I want is the following.
How can I find the number - in this case the 740 - if I do not know the full specific_filename?
Eg. I know only the 'libvclient_release_x64.so.' part of the filename, but do not know the last '740' part of it, and want to find that unknown part?
does not do the job.
Welcome to forums, I hope you will enjoy learning and sharing knowledge here. Could you please try following and let me know if this helps you. EDIT: Adding this solution after seeing your POST#2, let me know if this helps you.
Thanks,
R. Singh
Last edited by RavinderSingh13; 08-21-2017 at 10:34 AM..
Reason: Adding this solution after seeing OP POST#2.
This User Gave Thanks to RavinderSingh13 For This Post:
Welcome to forums, I hope you will enjoy learning and sharing knowledge here. Could you please try following and let me know if this helps you.
[/CODE] EDIT: Adding this solution after seeing your POST#2, let me know if this helps you.
Thanks,
R. Singh
It works, thank you.
I wonder if it works if the filname will change so, so the number at the and will change into four digit number too?
It works, thank you.
I wonder if it works if the filname will change so, so the number at the and will change into four digit number too?
Hello csanyipal,
Glad that it helped you. You could HIT THANKS button at left most corner of each post if you find any post useful. Off course above will not work for every file name. Since you have provided pattern specific file patterns so I had written as per that file name(s). You may need to change the pattern of file(s) in case your name changes too.
Let me know if you have any queries on same.
Thanks,
R. Singh
Last edited by RavinderSingh13; 08-21-2017 at 10:51 AM..
This User Gave Thanks to RavinderSingh13 For This Post:
Welcome to forums, I hope you will enjoy learning and sharing knowledge here. Could you please try following and let me know if this helps you. EDIT: Adding this solution after seeing your POST#2, let me know if this helps you.
Thanks,
R. Singh
Quote:
Originally Posted by RavinderSingh13
Hello csanyipal,
Glad that it helped you. You could HIT THANKS button at left most corner of each post if you find any post useful. Off course above will not work for every file name. Since you have provided pattern specific file patterns so I had written as per that file name(s). You may need to change the pattern of file(s) in case your name changes too.
Let me know if you have any queries on same.
Thanks,
R. Singh
I am trying to use this in my ebuild:
but it does not work, the symlink is not created properly:
It seems that that the link is pointing to it self. Why? How can I fix this?
Hello,
I need to add a part of folder name to the files inside it. For instance the file is
HMCBackup_20150430.155027.tgz
and it is under directory /nim/dr/HMCBackup/cops22
I need to add cops22 to the file name so as it would be cops22_HMCBackup_20150430.155027.tgz
Any help in doing... (10 Replies)
Hi guys!
I have quite a lot of files like
all_10001_ct1212307460308.alf*
and I want to get rid of the first number for all at once like:
all_ct1212307460308.alf*
How can I do this in the shell? (12 Replies)
Hi All,
Thanks in Advance
Shell Script or Perl Script
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... (7 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 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,
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'm trying to get part of a filename and my skill with regular expression are lacking. I know I need to use SED but have no idea how to use it. I'm hoping that someone can help me out. The file names would be:
prefix<partwewant>suffix.extension
the prefix and suffix are always 3... (4 Replies)
I've many file like this
01-file
01_-_file
01_-_file
01_-_file
01_-_file
01-file
I would remove bold part from filename. Suggestions?Thanks (4 Replies)
I like to have the date in the 2008-09-01 format at the beginning of my filenames. I then hyphenate after that and then have my filename.
I have a script that creates this for me. However, I may be working on files that already have the date format already in there and so I don't want to have a... (4 Replies)
Hi,
I need to extract only a part of the filenames of some files. The files are named this way :
.tap_profile_SIT02
I want the "SIT02" part, which is not the same for each file. I was able to get what I want with bash, but not with ksh. Here is the command I used in bash :
find... (8 Replies)