Sponsored Content
Top Forums Shell Programming and Scripting How to trim a string in unix shell script Post 302486945 by Shri123 on Monday 10th of January 2011 11:27:02 PM
Old 01-11-2011
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'
( instead of '$/folder1/folder2/filename'). There is a space between in the first quote and $. How to avoid this space.Is there any trim function?
 

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. 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

4. 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

5. 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

6. 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

7. 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

8. Shell Programming and Scripting

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. (6 Replies)
Discussion started by: Ananthdoss
6 Replies

9. 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

10. Shell Programming and Scripting

UNIX shell script to search a string in a file

Hi folks, I am new for shell script, I hope somebody to help me to write shell script My requirement is below steps 1. I have apache access.log i.e located in /var/log/httpd/ Ex. 127.0.0.1 - - "GET... (14 Replies)
Discussion started by: Chenchireddy
14 Replies
Gnome2::Config(3pm)					User Contributed Perl Documentation				       Gnome2::Config(3pm)

NAME
Gnome2::Config METHODS
boolean = Gnome2::Config->get_bool ($path) o $path (string) boolean = Gnome2::Config::Private->get_bool ($path) o $path (string) Gnome2::Config->set_bool ($path, $value) o $path (string) o $value (boolean) Gnome2::Config::Private->set_bool ($path, $value) o $path (string) o $value (boolean) list = Gnome2::Config->get_bool_with_default ($path) o $path (string) Returns a boolean indicating whether the default was used and the actual value. list = Gnome2::Config::Private->get_bool_with_default ($path) o $path (string) Gnome2::Config->clean_file ($path) o $path (string) Gnome2::Config::Private->clean_file ($path) o $path (string) Gnome2::Config->clean_key ($path) o $path (string) Gnome2::Config::Private->clean_key ($path) o $path (string) Gnome2::Config->clean_section ($path) o $path (string) Gnome2::Config::Private->clean_section ($path) o $path (string) Gnome2::Config->drop_all Gnome2::Config->drop_file ($path) o $path (string) Gnome2::Config::Private->drop_file ($path) o $path (string) double = Gnome2::Config->get_float ($path) o $path (string) double = Gnome2::Config::Private->get_float ($path) o $path (string) Gnome2::Config->set_float ($path, $value) o $path (string) o $value (double) Gnome2::Config::Private->set_float ($path, $value) o $path (string) o $value (double) list = Gnome2::Config->get_float_with_default ($path) o $path (string) Returns a boolean indicating whether the default was used and the actual value. list = Gnome2::Config::Private->get_float_with_default ($path) o $path (string) boolean = Gnome2::Config->has_section ($path) o $path (string) boolean = Gnome2::Config::Private->has_section ($path) o $path (string) scalar = Gnome2::Config->init_iterator ($path) o $path (string) scalar = Gnome2::Config::Private->init_iterator ($path) o $path (string) scalar = Gnome2::Config->init_iterator_sections ($path) o $path (string) scalar = Gnome2::Config::Private->init_iterator_sections ($path) o $path (string) integer = Gnome2::Config->get_int ($path) o $path (string) integer = Gnome2::Config::Private->get_int ($path) o $path (string) Gnome2::Config->set_int ($path, $value) o $path (string) o $value (integer) Gnome2::Config::Private->set_int ($path, $value) o $path (string) o $value (integer) list = Gnome2::Config->get_int_with_default ($path) o $path (string) Returns a boolean indicating whether the default was used and the actual value. list = Gnome2::Config::Private->get_int_with_default ($path) o $path (string) Gnome2::Config->pop_prefix Gnome2::Config->push_prefix ($path) o $path (string) string = Gnome2::Config->get_real_path ($path) o $path (string) string = Gnome2::Config::Private->get_real_path ($path) o $path (string) string = Gnome2::Config->get_string ($path) o $path (string) string = Gnome2::Config::Private->get_string ($path) o $path (string) Gnome2::Config->set_string ($path, $value) o $path (string) o $value (string) Gnome2::Config::Private->set_string ($path, $value) o $path (string) o $value (string) list = Gnome2::Config->get_string_with_default ($path) o $path (string) Returns a boolean indicating whether the default was used and the actual value. list = Gnome2::Config::Private->get_string_with_default ($path) o $path (string) boolean = Gnome2::Config->sync boolean = Gnome2::Config->sync_file ($path) o $path (string) boolean = Gnome2::Config::Private->sync_file ($path) o $path (string) string = Gnome2::Config->get_translated_string ($path) o $path (string) string = Gnome2::Config::Private->get_translated_string ($path) o $path (string) Gnome2::Config->set_translated_string ($path, $value) o $path (string) o $value (string) Gnome2::Config::Private->set_translated_string ($path, $value) o $path (string) o $value (string) list = Gnome2::Config->get_translated_string_with_default ($path) o $path (string) list = Gnome2::Config::Private->get_translated_string_with_default ($path) o $path (string) scalar = Gnome2::Config->get_vector ($path) o $path (string) scalar = Gnome2::Config::Private->get_vector ($path) o $path (string) Gnome2::Config->set_vector ($path, $value) o $path (string) o $value (scalar) Gnome2::Config::Private->set_vector ($path, $value) o $path (string) o $value (scalar) list = Gnome2::Config->get_vector_with_default ($path) o $path (string) Returns a boolean indicating whether the default was used and the actual value. list = Gnome2::Config::Private->get_vector_with_default ($path) o $path (string) SEE ALSO
Gnome2 COPYRIGHT
Copyright (C) 2003-2004 by the gtk2-perl team. This software is licensed under the LGPL. See Gnome2 for a full notice. perl v5.14.2 2011-11-16 Gnome2::Config(3pm)
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy