Sponsored Content
Top Forums Shell Programming and Scripting TRIM a string in shell script Post 302561765 by Ananthdoss on Wednesday 5th of October 2011 07:21:11 AM
Old 10-05-2011
TRIM a string in shell script

HI,
I have a string "NZ-deploy-mode-1.15-Linux.x86_64.rpm"

I want to get the string before -1 ie "NZ-deploy-mode"

Input is "NZ-deploy-mode-1.15-Linux.x86_64.rpm"

expected output is "NZ-deploy-mode"




How can I do that in shell script?

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reversing and trim a String through SHELL script

All I want to reverse and trim a string using UNIX shell scripts.Iam using Bourne shells. Can you help me? Thanx in advance Regards Deepak (5 Replies)
Discussion started by: DeepakXavier
5 Replies

2. UNIX for Dummies Questions & Answers

trim leading zero in certain column in a string

I would like to know how to trim leading zero only in certain column of of a string, example: hdhshdhdhd000012mmmm0002abc <===== before hdhshdhdhd 12mmmm 2abc <===== after Thanks for your help. (2 Replies)
Discussion started by: dngo
2 Replies

3. UNIX for Advanced & Expert Users

TRIM spaces in shell

am get a value like ' 15' in a variable what is the easiest method i can follow to strip 15 out (3 Replies)
Discussion started by: anumkoshy
3 Replies

4. Programming

How to trim the white space around a string in C program

I am coding a C program to read a plain text file. There are a lot of blank fields or a string with white spaces. I want to know is there such a function called trim() in C to clean the white space around a string? Or some other way can do this efficiently? Thanks. (18 Replies)
Discussion started by: hxm1303
18 Replies

5. Shell Programming and Scripting

To trim Certain field in a line of a file and replace the new string in that position

To trim 3rd field in for all the lines of a file and replace the modified string in that particular field. For example i have a file called Temp.txt having content Temp.txt ----------------- 100,234,M1234 400,234,K1734 300,345,T3456 ---------------- So the modified file output should... (4 Replies)
Discussion started by: rpadhi
4 Replies

6. Shell Programming and Scripting

Need help in shell script to trim numeric values

Hello I am currently working on a shell script which actually needs to pull some file from a server , The filenames will have the extension with date/time stamp , i need to trim that and name it to proper format Example : xyz_20091108_22142365.gzip i need to remove the... (5 Replies)
Discussion started by: ranga27
5 Replies

7. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

8. Shell Programming and Scripting

How to trim a string in unix shell script

I am reading a string like $/folder1/folder2/filename from a file And I am storing it in a variable say $path. I want to store the path within single quotes in order to use the path within a command. if i set like path="'"$path"'" echo $path It is printing like ' $/folder1/folder2/filename'... (6 Replies)
Discussion started by: Shri123
6 Replies

9. Shell Programming and Scripting

Can i use trim in shell script ?

Hi, I am stuck at comparing a value from database with a space involved. Condition if (cust_code != "RAMK" && cust_code != "LML") { xxxxxxx xxxxxxx xxxxxxx } the cust_code is from a table and generally has 4 chars...so in the case of LML it comes with default space at the end. ... (1 Reply)
Discussion started by: ramkiran77
1 Replies

10. Shell Programming and Scripting

Trim String

Hi, I wish to grep everything before the last "/bin" in the following string /opt/app/bin/app1/jdk150_07/bin/IA64N/java Desired output: "/opt/app/bin/app1/jdk150_07" Kindly help ... (2 Replies)
Discussion started by: mohtashims
2 Replies
asadmin-create-connector-connection-pool(1AS)			   User Commands		     asadmin-create-connector-connection-pool(1AS)

NAME
asadmin-create-connector-connection-pool, create-connector-connection-pool - adds a connection pool with the specified connection pool name SYNOPSIS
create-connector-connection-pool --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--password- file filename] [--terse=false] [--echo=false] [--interactive=true] [--steadypoolsize 8] [--maxpoolsize 32] [--maxwaittime 3000] [--poolre- size 2] [--idletimeout 300] [--failallconnections=false]--raname resource_adapter_name --connectiondefinition connection-definition_name [--property name=value[:name=value]*] pool_name Adds a new connector connection pool. Before you can add a new connector connection pool, you must first deploy the associated RAR file. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. --steadypoolsize minimum and initial number of connections maintained in the pool (default is 8). --maxpoolsize maximum number of connections that can be created to satisfy client requests (default is 32). --maxwaittime amount of time, in milliseconds, that a caller will have to wait before a connection is created if a connection is not available. If set to 0 the caller is blocked indefinately until a resource is available or an error occurs (default is 60000). --poolresize the number of connections to be removed when idletimeout timer expires. Connections that have idled for longer than the timeout are candidates for removal. When the pool size reaches the steadypoolsize, the connection removal stops. --idletimeout the maximum time that a connection can remain idle in the pool. After this amount of time, the pool can close this connection (default is 300). --failallconnections if true, closes all connections in the pool if a single validation check fails. This parameter is mandatory only if the is-connection-validation-required is set to true. Legal values are: on, off, yes, no, 1, 0, true or false (default is false). --raname module name of the deployed resource adapter. In case of a resource adapter that is embedded in an application, the raname will be appname#raname. --connectiondefinition identifies one of the connection definitions in the deployment descriptor of a resource adapter. Value of connec- tionfactory-interface sub-element in the connection-definition element. --property name/value pair of the configuration properties of the managedconnectionfactory-class of the connectiondefinition for which the pool is being created. The UserName and Password are accepted by default for all pools. The escape character " OPERANDS
pool_name name of the connection pool to be created. Example 1: Using create-connector-connection-pool The JMS resource adapter that is prepackaged with the application server is used for this example. Before you can add a new connector con- nection pool, you must first deploy the associated RAR file. To deploy the RAR file: asadmin> deploy --user admin --password adminadmin jmsra.rar Command deploy executed successfully asadmin> create-connector-connection-pool --user admin1 --password adminadmin1 --steadypoolsize 20 --maxpoolsize 100 --poolresize 2 --maxwait 60000 --raname jmsra --connectiondefinition javax.jms.QueueConnectionFactory --property UserName=guest:Password=guest jms/qConnPool Command create-connector-connection-pool executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-deploy(1AS), asadmin-delete-connector-connection-pool(1AS), asadmin-list-connector-connection-pools(1AS) J2EE 1.4 SDK March 2004 asadmin-create-connector-connection-pool(1AS)
All times are GMT -4. The time now is 11:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy