Sponsored Content
Top Forums Shell Programming and Scripting deleting 'carriage return' from string Post 302174593 by viko on Tuesday 11th of March 2008 02:14:00 PM
Old 03-11-2008
well.

i made it, and just to help anyone eho needs something like this:

i have made something like:

dirty_var='
something'

var="$(echo $dirty_var | grep some_char_u_know_exists_in_var)"

for checking:
bash-2.05$ if [ "$dirty_var" == "something" ]; then echo OK; fi
bash-2.05$ if [ "$(echo $dirty_var | grep some)" == "something" ]; then echo OK; fi
OK
bash-2.05$



regards
VIKO
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture carriage return.

I try to test the carriage return in a variable. $ LENGTH=`expr $VARIABLE : ".*"` will return the length of the variable. But this doesn't work if $VARIABLE has zero length. Any help will be well appreciated. Thanks in advance. Giovanni (4 Replies)
Discussion started by: gio123bg
4 Replies

2. Shell Programming and Scripting

Dont want carriage return

I have observed with print & echo, they produce carriage return <CR> or newline, after they display string next to them. Is there anyway to avoide these <CR> after the intended string is displayed? (3 Replies)
Discussion started by: videsh77
3 Replies

3. UNIX for Dummies Questions & Answers

carriage return and linefeed

hi can anyone please tell me the difference between carriage return, linefeed and newline ? (2 Replies)
Discussion started by: streetfi8er
2 Replies

4. UNIX for Dummies Questions & Answers

Remove ^M (carriage return) with string manipulation

Hello, I want remove ^M at end of my files line if I use command : tr -d '\r' <inp>out it work fine but get I the same result by manipulating the string ? I want this because in my text file I manipulate some other part I have input "the cat^M" I want output "the cat" I have made... (3 Replies)
Discussion started by: aquila_1
3 Replies

5. Shell Programming and Scripting

2 carriage return within a record

Hi all, need your help in replacing carriage return in a record. Input: col1|col2|col3|col4|col5|col6|col7|col8|col9|col10 1|aa|bb|cc|dd|eee eee|ff|ggggg|hh hhh|iii 2|zz|yy|xx|ww|vv|uu|tt|ss|rr Output: col1|col2|col3|col4|col5|col6|col7|col8|col9|col10... (12 Replies)
Discussion started by: agathaeleanor
12 Replies

6. Shell Programming and Scripting

Search_Replace with a Carriage Return

Hey folks, I've been working on this for some time. Seems simple, but I'm stumped. I need the following data format: New_York:Commercial Geology Geophysics Petrophysics Production_Engineering Reservoir_Engineering Pasadena:Commercial ... (5 Replies)
Discussion started by: leepet01
5 Replies

7. Shell Programming and Scripting

Removing Carriage return in a file after particular string

Hi All, I want to remove carriage return in a file using some unix command without writing a script my file is as follows abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 I want the output as follows: abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 , Please... (7 Replies)
Discussion started by: manish8484
7 Replies

8. Shell Programming and Scripting

Carriage return ksh

Hello, How do i usecarriage return in ksh. I want to do an echo "bla bla" and another echo "bla bla" will appear and replace the first echo on screen. I tried: until ; do echo "bla bla \r" done please advice. Thanks. (3 Replies)
Discussion started by: LiorAmitai
3 Replies

9. Shell Programming and Scripting

Substitute \n with carriage return

Hello all, I've a flat file in the following format: AB\001\CDED\001\ABC\001\nEG\001\HIJF\001\EFG\001\nHI\003\HIUL\003\HIJ\003 And I want to substitute \n with the carriage return. Any help is appreciated! Regards, - Seth (8 Replies)
Discussion started by: sethmj
8 Replies

10. Shell Programming and Scripting

ksh string replacement over a carriage return

Hi. I need to make multiple string replacements in a file but several of the strings have been broken up by a carriage return so that the first few characters are on one line and the remainder on the following line. E.g like the word 'post' in the following: Use descriptive thread... (3 Replies)
Discussion started by: Big_Jeffrey
3 Replies
HTTPQUERYSTRING(3)							 1							HTTPQUERYSTRING(3)

The HttpQueryString class

CLASS SYNOPSIS
HttpQueryString HttpQueryStringArrayAccessSerializable o final public HttpQueryString::__construct ([bool $global = true], [mixed $add]) o public mixed HttpQueryString::get NULL ([string $key], [mixed $type], [mixed $defval], [bool $delete = false]) o public HttpQueryString HttpQueryString::mod (mixed $params) o public string HttpQueryString::set (mixed $params) o static public HttpQueryString HttpQueryString::singleton ([bool $global = true]) o public array HttpQueryString::toArray (void ) o public string HttpQueryString::toString (void ) o public bool HttpQueryString::xlate (string $ie, string $oe) CLASS MEMBERS
PROPERTIES
Instance Properties +----------+-----------------------------+---+---+ |Modifiers | | | | | | | | | | | Type | | | | | | | | | | Name | | | | | | | | | | Description | | | | | | | | +----------+-----------------------------+---+---+ | private | | | | | | | | | | | array | | | | | | | | | | queryArray | | | | | | | | | | query parameters | | | | | | | | | private | | | | | | | | | | | string | | | | | | | | | | queryString | | | | | | | | | | serialized query parameters | | | | | | | | +----------+-----------------------------+---+---+ Static Properties +----------+------------------+---+ |Modifiers | | | | | | | | | Type | | | | | | | | Name | | | | | | | | Description | | | | | | +----------+------------------+---+ | private | | | | | | | | | array | | | | | | | | instance | | | | | | | | holds singletons | | | | | | +----------+------------------+---+ PREDEFINED CONSTANTS
+-----+--------------------------------+---+ |Type | | | | | | | | | Name | | | | | | | | Description | | | | | | +-----+--------------------------------+---+ |int | | | | | | | | | TYPE_BOOL | | | | | | | | retrieve query param as bool | | | | | | |int | | | | | | | | | TYPE_INT | | | | | | | | retrieve query param as int | | | | | | |int | | | | | | | | | TYPE_FLOAT | | | | | | | | retrieve query param as float | | | | | | |int | | | | | | | | | TYPE_STRING | | | | | | | | retrieve query param as string | | | | | | |int | | | | | | | | | TYPE_ARRAY | | | | | | | | retrieve query param as array | | | | | | |int | | | | | | | | | TYPE_OBJECT | | | | | | | | retrieve query param as object | | | | | | +-----+--------------------------------+---+ PHP Documentation Group HTTPQUERYSTRING(3)
All times are GMT -4. The time now is 02:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy