Sponsored Content
Full Discussion: Need to remove slash
Top Forums Shell Programming and Scripting Need to remove slash Post 302851317 by Scrutinizer on Sunday 8th of September 2013 06:28:17 AM
Old 09-08-2013
awk version:
Code:
.. | awk -F/ '{sub(FS,x); $1=$1}1'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep for forward slash

How can I use grep to grab a line that contains a forward slash? I've tried: grep "/pd " file, Inevitably it just grabs pd not /pd. (3 Replies)
Discussion started by: wxornot
3 Replies

2. Shell Programming and Scripting

awk slash

I have configuration file(master.cnf), that contents are: VER1LOG /src/ver1/log VER2LOG /src/ver2/log APPLOG /src/sys/apps/log APPCONF /src/sys/apps/conf APPBIN /src/sys/apps/bin my shell script is as below mylog=sys/apps awk "/$mylog/" master.cnf awk: syntax error Context is: >>> ... (6 Replies)
Discussion started by: McLan
6 Replies

3. Shell Programming and Scripting

Replace the last slash alone

Hi All, Can you please help me with the below issue. I want only the last slash to be replaced with space. 06/05/2008/EDED_FD_BDCD_ABCD_123 06/05/2008 EDED_FD_BDCD_ABCD_123 (3 Replies)
Discussion started by: christineida
3 Replies

4. Shell Programming and Scripting

About \ (Back slash)

Hi All, print "path/executable_file parameters" \ > path/file1 print "path/executable_file parameters" \ > path/file2 print "path/executable_file parameters" \ > path/file3 chmod 775 path/file1 \ path/file2 \ ... (7 Replies)
Discussion started by: Arunprasad
7 Replies

5. UNIX for Advanced & Expert Users

Substitute single backward-slash with the double backward-slash

Hi, I have a path like this c:\test\sample\programs, i need to change thiis to c:\\test\\sample\\programs. How to perform this? I tried tr command but it didn't help me. Thanks Vijayan (3 Replies)
Discussion started by: mvictorvijayan
3 Replies

6. Shell Programming and Scripting

Using sed to append backward slash before forward slash

Hi all, I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
Discussion started by: sarbjit
2 Replies

7. Shell Programming and Scripting

Slash delimiter

I have a log file which on field $11 there is sth like: /A/B/C and I want to extract the last part which is C. for space delimiter I used: awk '{print $2 " " $5 ";" $7 ";" $9 ";" $11}' and had no problem. but dont know how to extract the 3rd part of the slash delimiter. That would be... (6 Replies)
Discussion started by: frhling
6 Replies

8. Shell Programming and Scripting

Remove leading dot and slash on relative paths with find

When I specify a directory by name the leading ./ is not shown: $ find somedir/ somedir/a.bin somedir/target/out.binBut when I specify current dir it adds the ./ to the beginning of each result: $ find . | grep somedir ./somedir/a.bin ./somedir/target/out.binIs there any particular reason why... (2 Replies)
Discussion started by: Tribe
2 Replies

9. Shell Programming and Scripting

Substitution to remove tailing slash?

Heyas I am trying to remove a tailing space, with substitution. Already tried some multiple escapes with no luck, is that even possible? echo $CHROOT || \ CHROOT="${CHROOT/\/$}" echo $CHROOT return And all i get is: :) paths $ CHROOT=/usr/local/ + paths $ . * /usr/local/ /usr/local/... (2 Replies)
Discussion started by: sea
2 Replies

10. Shell Programming and Scripting

Escaping Forward Slash

./split2.sh: line 1: split/ssl/pop3s.txt: No such file or directory sort: cannot read: split/ssl/pop3s.txt: No such file or directory Hi there, I am pulling data from the following source: ssl/http ssl/http ssl/http-alt ssl/https ssl/https ssl/https ssl/https ssl/https ssl/https... (3 Replies)
Discussion started by: alvinoo
3 Replies
basename(1)						      General Commands Manual						       basename(1)

NAME
basename, dirname - extract portions of path names SYNOPSIS
string [suffix] [string] DESCRIPTION
deletes any prefix ending in and the suffix (if present in string) from string, and prints the result on the standard output. If string consists entirely of slash characters, string is set to a single slash character. If there are any trailing slash characters in string, they are removed. If the suffix operand is present but not identical to the characters remaining in string, but it is identical to a suf- fix of the characters remaining in string, the suffix is removed from string. is normally used inside command substitution marks within shell procedures. delivers all but the last level of the path name in string. If string does not contain a directory component, returns indicating the cur- rent working directory. EXTERNAL INFLUENCES
Environment Variables determines the interpretation of string and, in the case of basename, suffix as single and/or multi-byte characters. If is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty vari- able. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, and behave as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. EXAMPLES
The following shell script, invoked with the argument compiles the named file and moves the output to a file named in the current direc- tory: The following example sets the shell variable to RETURN VALUE
and return one of the following values: Successful completion. Incorrect number of command-line arguments. SEE ALSO
expr(1), sh(1). STANDARDS CONFORMANCE
basename(1)
All times are GMT -4. The time now is 07:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy