06-03-2014
Quote:
Originally Posted by
IshuGupta
Thanks a bunch Aia.....it works..... when you get time...can you please tell me how ##*/ works
## (2#) to match as much of the pattern (in this case
*/) and strip it, starting from the beginning
There are also:
# (1#) same that ## except that it will match as less as possible (no greedy)
If you want to start from the end of the content, then you use
% or
%%
This User Gave Thanks to Aia For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a text file with full list of files with their full path. I wanted to sort it by directory then files then subdirectory by alphabetically. When I used the sort command it doesn't give like what I want. Could somebody help me on this.
Here is the ex:
This is what I'm getting... (2 Replies)
Discussion started by: javidraaj
2 Replies
2. 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
3. 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
4. UNIX for Dummies Questions & Answers
Hi,
Is there a command that tells you right away the current working directory? I know the command "pwd", but that one gives the full path.
if pwd gives me:
/a/b/c/d/ggg/HERE
I want something that will give me:
HERE
Thanks,
Gaurab (13 Replies)
Discussion started by: gaurab
13 Replies
5. Shell Programming and Scripting
Hey
I'm new to the forums here, and I'm seeking help for this script that I'm writing. When I do ls -l of a directory it shows the full pathname for files in it. For example, if the directory is /internet/post/forum/ and the file is topic, it currently shows internet/post/forum/topic. What's the... (3 Replies)
Discussion started by: unity04
3 Replies
6. Shell Programming and Scripting
I'm running AIX unix korn shell. If I echo $0, I only get the filename, it does not have the directory name also. So when I do: `dirname $0` it returns a . (meaning current directory). How get $0 to return the full path/filename? Do I need something in my .profile? Thank you. (8 Replies)
Discussion started by: sboxtops
8 Replies
7. Shell Programming and Scripting
How to list all Subdirectories and files with its full path in a parent directory? (1 Reply)
Discussion started by: johnveslin
1 Replies
8. UNIX for Dummies Questions & Answers
I think I know what this is doing, but the 'eval' is confusing
fname=$(echo ${lineItem} | awk 'BEGIN {FS=";"}{print $1}')
fname=${fname%%+(])}
fname=${fname##+(])}
eval "fname=${fname}"
The first line extracts the contents of the line preceeding the ";"
2nd & 3rd lines trim the value (I... (5 Replies)
Discussion started by: jdorn001
5 Replies
9. Shell Programming and Scripting
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies
10. UNIX for Beginners Questions & Answers
i was attempting to extract a directory path that was passed from a parameter with this code
vdir=`dirname $p1`
echo current directory $vdir
it does not work when the parameter passed has wild card on it.
for example
$ sh sample1.sh "/sbin/log/c*.log"
dirname: extra operand... (2 Replies)
Discussion started by: wtolentino
2 Replies
LEARN ABOUT FREEBSD
strip
STRIP(1) BSD General Commands Manual STRIP(1)
NAME
strip -- discard information from ELF objects
SYNOPSIS
strip [-d | -g | -S | --strip-debug] [-h | --help] [--only-keep-debug] [-o outputfile | --output-file=outputfile] [-p | --preserve-dates]
[-s | --strip-all] [--strip-unneeded] [-w | --wildcard] [-x | --discard-all] [-I format | --input-target=format]
[-K symbol | --keep-symbol=symbol] [-N symbol | --strip-symbol=symbol] [-O format | --output-target=format]
[-R sectionname | --remove-section=sectionname] [-V | --version] [-X | --discard-locals] file ...
DESCRIPTION
The strip utility is used to discard information from ELF objects.
The strip utility supports the following options:
-d | -g | -S | --strip-debug
Remove debugging symbols only.
-h | --help
Print a help message and exit.
--only-keep-debug
Remove all content except that which would be used for debugging.
-o outputfile | --output-file=outputfile
Write the stripped object to file outputfile. The default behaviour is to modify objects in place.
-p | --preserve-dates
Preserve the object's access and modification times.
-s | --strip-all
Remove all symbols.
--strip-unneeded
Remove all symbols not needed for further relocation processing.
-w | --wildcard
Use shell-style patterns to name symbols. The following meta-characters are recognized in patterns:
! If this is the first character of the pattern, invert the sense of the pattern match.
* Matches any string of characters in a symbol name.
? Matches zero or one character in a symbol name.
[ Mark the start of a character class.
Remove the special meaning of the next character in the pattern.
] Mark the end of a character class.
-x | --discard-all
Discard all non-global symbols.
-I format | --input-target=format
These options are accepted, but are ignored.
-K symbol | --keep-symbol=symbol
Keep the symbol symbol even if it would otherwise be stripped. This option may be specified multiple times.
-N symbol | --strip-symbol=symbol
Remove the symbol symbol even if it would otherwise have been kept. This option may be specified multiple times.
-O format | --output-target=format
Set the output file format to format. For the full list of supported formats, please see the documentation for function
elftc_bfd_find_target(3).
-R sectionname | --remove-section=sectionname
Remove the section named by the argument sectionname. This option may be specified multiple times.
-V | --version
Print a version identifier and exit.
-X | --discard-locals
Remove compiler-generated local symbols.
DIAGNOSTICS
The strip utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
ar(1), elfcopy(1), ld(1), mcs(1), elf(3), elftc_bfd_find_target(3), fnmatch(3)
BSD
September 17, 2011 BSD