Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Remove a carriage return at end of variable Post 58302 by PxT on Wednesday 17th of November 2004 03:28:39 PM
Old 11-17-2004
Code:
$ FOO="bar
> "
$ echo "$FOO"
bar

$ BAR=$FOO
$ echo "$BAR"
bar

$ BAR=`echo $FOO`
$ echo "$BAR"
bar
$


In other words, "echo" will chomp it when used without quotes.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regex to pick up name from the following including carriage return at end of the line

has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return. ie i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME. Any ideas are appreciated! ... (3 Replies)
Discussion started by: Shakey21
3 Replies

2. Shell Programming and Scripting

Carriage Return at end of file

Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies

3. UNIX for Dummies Questions & Answers

To remove carriage return between the line

Hi, I have a situation where I need to remove the carriage return between the lines. For.eg. The input file: 1,ad,"adc sdfd",edf 2,asd,"def fde",asd The output file should be 1,ad,adc sdfd,edf 2,asd,def fde,asd Thanks Shash (5 Replies)
Discussion started by: shash
5 Replies

4. Shell Programming and Scripting

add carriage return at end of file

Hi I would like to add carriage return at end of file, because we need to mask the customer names for detailed records. Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use ---aa.txt----- 1|aaa|bbb|ccc 2|bbbb|hghgh|ggg 000002 tail... (2 Replies)
Discussion started by: HAA
2 Replies

5. UNIX for Advanced & Expert Users

Padding Carriage return to the end of XML file

Hi All, I am getting a xml file where the first field contains a carriage return and the all other fields doesnot contains any carriage return. So all the other records comes in the second line. <?xml version="1.0" encoding="UTF-8"?> <ns0:iSeriesCspIntegration... (3 Replies)
Discussion started by: dasj22
3 Replies

6. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

7. Shell Programming and Scripting

Need a carriage return at end of each line

Hi All, I am reading two files and writing out the file name and count of lines in each file to an output file. My script looks like this: echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies

8. Shell Programming and Scripting

Remove carriage return in a record

Hi all gurus, I need help in removing carriage return existed within a record delimited by pipe <|>. Sample: A_01|Test1|Testing1|Remarks1 A_02|Test2|Test ing2|Remarks2 A_03|Test3|Testing3| Remarks3 Desire output: A_01|Test1|Testing1|Remarks1 A_02|Test2|Testing2|Remarks2... (10 Replies)
Discussion started by: agathaeleanor
10 Replies

9. Shell Programming and Scripting

Remove carriage return from the variable

Hi, I try to handle very large numbers with a bash script. I run ssh command in a remote server and store the output in a local variable. But this output contains a return carriage at the end. So I try to remove it by tr But I can't figure out the right notation with printf. So my problem... (6 Replies)
Discussion started by: Meacham12
6 Replies

10. UNIX for Dummies Questions & Answers

Remove carriage return

I need to remove the carriage return comes inbetween the record. Need to have CR only at the end. I used the below command. tr -d '\n' < filewithcarriagereturns > filewithoutcarriagereturns But its removing all the CR and giving one line output. Input File: 12345 abcdegh... (11 Replies)
Discussion started by: srvn_saru
11 Replies
PPIx::Utilities::Statement(3pm) 			User Contributed Perl Documentation			   PPIx::Utilities::Statement(3pm)

NAME
PPIx::Utilities::Statement - Extensions to PPI::Statement. VERSION
This document describes PPIx::Utilities::Statement version 1.1.0. SYNOPSIS
use PPI::Document qw< >; use PPIx::Utilities::Statement qw< get_constant_name_elements_from_declaring_statement >; my $document = PPI::Document->new('Readonly::Scalar my $THINGY => 47.2;'); # Returns the PPI::Token::Symbol for "$THINGY". my ($constant) = get_constant_name_elements_from_declaring_statement( $document->schild(0) ); DESCRIPTION
This is a collection of functions for dealing with PPI::Statements. INTERFACE
Nothing is exported by default. "get_constant_name_elements_from_declaring_statement($statement)" Given a PPI::Statement, if the statement is a Readonly or Const::Fast declaration statement or a "use constant", returns the names of the things being defined. Given use constant 1.16 FOO => 'bar'; this will return the PPI::Token::Word containing 'FOO'. Given use constant 1.16 { FOO => 'bar', 'BAZ' => 'burfle' }; this will return a list of the PPI::Tokens containing 'FOO' and 'BAZ'. Similarly, given Readonly::Hash my %FOO => ( bar => 'baz' ); or const my %FOO => ( bar => 'baz' ); this will return the PPI::Token::Symbol containing '%FOO'. BUGS AND LIMITATIONS
Please report any bugs or feature requests to "bug-ppix-utilities@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. AUTHOR
Thomas R. Wyant, III "<wyant at cpan dot org>" COPYRIGHT
Copyright (c) 2009-2010 Thomas R. Wyant, III. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.10.1 2010-12-03 PPIx::Utilities::Statement(3pm)
All times are GMT -4. The time now is 05:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy