06-28-2011
Need to extract a folder from a full path
Hi everyone,
I have different folders which looks like this:
/mnt/ecrm/master/ecrm/templates/
brochure/de_DE/zeitlos.ott
/mnt/ecrm/master/ecrm/templates/
mail/en_US/default.html
/templates/
header_and_footer/en_US/default.txt
I want to get the bold text only in a variable. I already have a regex prepared:
(\w+(?=\/\w+_\w)) => Get me the word before /anyword_anyword (here: de_DE or en_US)
But I don't know how the implement that into a bash shell script. I tried sed, which doen't support advanced regex and I am too stupid for awk.
Help?
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
What is the smartest way to just extract file name from a full path name.
e.g. if I have
/usr/sanjay/bin/file_name.c
I want only file_name.c
Sanjay (2 Replies)
Discussion started by: sanjay92
2 Replies
2. Shell Programming and Scripting
given a relative path, how do i convert it into a full one. i.e. if i am in
/home/polypus
and i am given foo/bar then to get a full path i can just concatinate it with pwd, but what if i am given "../mama"
how do i programmatically convert:
/home/polypus and ../mama into ... (4 Replies)
Discussion started by: polypus
4 Replies
3. UNIX for Dummies Questions & Answers
need a help,
am a newbe in unix
how do i locate the full path of the .profile where the environmental variable for a user is set.
thanks (6 Replies)
Discussion started by: dba
6 Replies
4. Windows & DOS: Issues & Discussions
Hello,
I am an amature at UNIX commands and functionality.
Please could you all assist me by replying to my below mentioned querry :
How can I upload a zip folder on a unix path from my windows folder?
Thanks guys
Cheers (2 Replies)
Discussion started by: ajit.yadav83
2 Replies
5. Shell Programming and Scripting
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Discussion started by: royalibrahim
2 Replies
6. Shell Programming and Scripting
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies
7. Shell Programming and Scripting
/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies
8. UNIX for Dummies Questions & Answers
My input is as below :
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt
/splunk/scrubbed/triumph/ifind.triumph.txt
From the above input I want to extract the file names only .
Basically I want to... (5 Replies)
Discussion started by: IshuGupta
5 Replies
9. Shell Programming and Scripting
Hello.
I use this command :
rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command.
And no full source directories are in use, only some files.
Source example... (2 Replies)
Discussion started by: jcdole
2 Replies
LEARN ABOUT CENTOS
alter_collation
ALTER
COLLATION(7) PostgreSQL 9.2.7 Documentation ALTER COLLATION(7)
NAME
ALTER_COLLATION - change the definition of a collation
SYNOPSIS
ALTER COLLATION name RENAME TO new_name
ALTER COLLATION name OWNER TO new_owner
ALTER COLLATION name SET SCHEMA new_schema
DESCRIPTION
ALTER COLLATION changes the definition of a collation.
You must own the collation to use ALTER COLLATION. To alter the owner, you must also be a direct or indirect member of the new owning role,
and that role must have CREATE privilege on the collation's schema. (These restrictions enforce that altering the owner doesn't do anything
you couldn't do by dropping and recreating the collation. However, a superuser can alter ownership of any collation anyway.)
PARAMETERS
name
The name (optionally schema-qualified) of an existing collation.
new_name
The new name of the collation.
new_owner
The new owner of the collation.
new_schema
The new schema for the collation.
EXAMPLES
To rename the collation de_DE to german:
ALTER COLLATION "de_DE" RENAME TO german;
To change the owner of the collation en_US to joe:
ALTER COLLATION "en_US" OWNER TO joe;
COMPATIBILITY
There is no ALTER COLLATION statement in the SQL standard.
SEE ALSO
CREATE COLLATION (CREATE_COLLATION(7)), DROP COLLATION (DROP_COLLATION(7))
PostgreSQL 9.2.7 2014-02-17 ALTER COLLATION(7)