Sponsored Content
Top Forums Shell Programming and Scripting Select a specific part of the string and print it Post 302476114 by Chubler_XL on Tuesday 30th of November 2010 10:45:26 PM
Old 11-30-2010
Standard sh dosn't support arrays, many linux flavours link /bin/sh to /bin/bash as this is probably what you have.

Your script is really close, a quick substring and delete from the from should get what you want:

Code:
#!/bin/bash
options=("arguments: --user=alpha --group=beta --prefix=/usr/share --proxy-path=/proxy --proxy-tmp=/tmp --conf-path=/etc")
for i in ${options[*]}; do
    if [ "${i:0:7}" = "--proxy" ]; then
        option=${i##*=} # the value present after the = sign"
        chmod 0755 $option
    fi
done

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cut and print part of a string

I have a file that contains: yahoo.com.23456 web.log.common.us.gov.8675 192.168.1.55.34443 john-doe.about.com.22233 64.222.3.4.120 sunny.ca.4442 how can i remove the strings after the last dot (.) and reprint the file? Thanks. (3 Replies)
Discussion started by: apalex
3 Replies

2. Shell Programming and Scripting

search-word-print-specific-string

Hi, Our input xml looks like: <doc> <str name="account_id">1111</str> <str name="prd_id">DHEP155EK</str> </doc> - <doc> <str name="account_id">6666</str> <str name="prd_id">394531662</str> </doc> - <doc> <str name="account_id">6666</str> <str... (1 Reply)
Discussion started by: Jassz
1 Replies

3. UNIX for Dummies Questions & Answers

Print part of string

I have a file called file.txt It contains strings: ALT=someone@acme.com TO=whoever@lalalulu.com How could find and print the actual address after the = sign for any given instance? I need the command to print one of them - for example someone@acme.com But have in mind that this... (3 Replies)
Discussion started by: svetoslav_sj
3 Replies

4. UNIX for Dummies Questions & Answers

How to Detect Specific Pattern and Print the Specific String after It?

I'm still beginner and maybe someone can help me. I have this input: the great warrior a, b, c and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this : Warrior Type a b c Im still very... (3 Replies)
Discussion started by: radynaraya
3 Replies

5. Shell Programming and Scripting

Print String Every Specific Line

Dear All, I have input file like this, 001 059 079 996 758 079 069 059 079 ... ... Desired output: AA 001 BB 059 (4 Replies)
Discussion started by: attila
4 Replies

6. Programming

Query to SELECT only Column Names that Contain a Specific String?

Hey Guys, I'm using SQuirreL SQL v3.5 GUI to fetch some data that I need for something I'm working on. I'm also using the IBM Informix Driver (*Version 3.5) to connect to the Database. What I want to do, if it's even possible, is to show all COLUMNS if they contain the word "Email". So in... (2 Replies)
Discussion started by: mrm5102
2 Replies

7. Shell Programming and Scripting

Print particular string in a field of csv file - part 2

Hi, all I need your help and suggestions. I want to print particular strings in a field of a csv file and show them in terminal. Here is an example of the csv file. SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw... (7 Replies)
Discussion started by: refrain
7 Replies

8. Shell Programming and Scripting

awk to print string if tag is specific value

In the below awk I am trying to print expName only if another tag planExecuted is true. In addition to the expName I am also printing planShortID. For some reason the word experiment gets printed so I remove it with sed. I have attached the complete index.html as well as included a sample of it... (1 Reply)
Discussion started by: cmccabe
1 Replies

9. Shell Programming and Scripting

How to print the specific part of the file name with file creation date?

Hello Folks, I have an requirement, where i need to get total count of the file based on creation date with there filename selected pattern. Filename: MobileProtocol.20171228T154200.157115.udr I want to get the count of files created on each day based on a pattern find. find . -type... (7 Replies)
Discussion started by: sadique.manzar
7 Replies
VOMS-PROXY-DESTROY(1)													     VOMS-PROXY-DESTROY(1)

NAME
voms-proxy-destroy - destroys a VOMS proxy SYNOPSIS
voms-proxy-destroy [options] DESCRIPTION
The voms-proxy-destroy is intended to be used after a proxy is no longer useful, to destroy it OPTIONS
Options may be specified indifferently with either a "-" or "--" prefix. The options from -help to -out are present for compatibility with grid-proxy-init, and have the exact same meaning. The meaning of the other ones is the following. -help Displays usage -version Displays version -debug Enables extra debug output -q Quiet mode, minimal output -file proxyfile The name of the file containing the proxy, in case it is in a non-standard place. -dry Doesn't actually destroy the proxy. -conf file Read options from file. BUGS
EGEE Bug Tracking Tool: https://savannah.cern.ch/projects/jra1mdw/ SEE ALSO
voms-proxy-init(1), voms-proxy-info(1) EDT Auth Home page: http://grid-auth.infn.it CVSweb: http://datagrid.in2p3.fr/cgi-bin/cvsweb.cgi/Auth/voms RPM repository: http://datagrid.in2p3.fr/distribution/autobuild/i386-rh7.3 AUTHORS
Vincenzo Ciaschini <Vincenzo.Ciaschini@cnaf.infn.it>. Valerio Venturi <Valerio.Venturi@cnaf.infn.it>. COPYRIGHT
Copyright (c) Members of the EGEE Collaboration. 2004. See the beneficiaries list for details on the copyright holders. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at www.apache.org/licenses/LICENSE-2.0: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITH- OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. VOMS-PROXY-DESTROY(1)
All times are GMT -4. The time now is 11:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy