Sponsored Content
Top Forums Shell Programming and Scripting Newline charachter in Ksh-Linux Post 302387640 by Sanju1236 on Sunday 17th of January 2010 10:46:39 PM
Old 01-17-2010
Newline charachter in Ksh-Linux

Hello,

I'm trying to create a muliti value shell variable with newlines inside it, So that I can read the values of that variable individually line by line, but KSH seems to be stripping my variable of newlines in LINUX, but UNIX its working fine.

Here's Example :

Code:
String = "Hello\n""How R U"

echo "$String" |\
   while read _line
   do
     echo $_line
  done

Output in Unix : Hello
Code:
How R U

But In Linux :
Code:
Hello\nHow R U

Please help in solving this.

Thanks!!!!

Last edited by pludi; 01-18-2010 at 02:02 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting occurences of specific charachter in a file

Hi, I need to count the number of occurences of the character " in a file that contains huge number of records. What command could I use? Please specify in detail since I am new :| Thanks much. (3 Replies)
Discussion started by: GMMike
3 Replies

2. Shell Programming and Scripting

Newline character not working for ksh

Newline character "\n" not working for ksh in linux AS 3.0 Command : $echo "Hi\nHi" $Hi\nHi $ Expected output : $echo "Hi\nHi" Hi Hi $ Can some help me on this Thanks in advance Sanish. (11 Replies)
Discussion started by: sanikv
11 Replies

3. Shell Programming and Scripting

problem escaping newline in ksh

Hi, I did the below. $ print "\\n" $ I am curious, why does \\n give two new lines? I would have thought that the first \ would escape the second \, and so we'd get \n printed. But we didn't. Any ideas? Thanks. (7 Replies)
Discussion started by: JamesByars
7 Replies

4. Shell Programming and Scripting

sed ksh remove newline between 2 containers

If we assume that each line between the {} container is an XML document then What I want to remove the newline character from all lines within each container to have one XMDL document per line I wrote a bit of sed after trawling the web: e.g. #!/bin/sed -nf H /}/ { x s/\n//g p... (3 Replies)
Discussion started by: JamesJSC
3 Replies

5. Shell Programming and Scripting

Need to cut filename in LINUX ksh

Hi, I need to cut filename in Linux ksh. for example file name is c_xxxx_cp_200908175035.zip. I need to get variable with only c_xxxx_cp value. (10 Replies)
Discussion started by: juliyp
10 Replies

6. Shell Programming and Scripting

delete line upto the nth occurence of a particular charachter.

hi all i want to delete a line upto a particular character. here is example. cp cms/images/wifi-zone.png i want to delete the line till . (cp cms/images/wifi-zone.) so the output wud be "png" only how can i do it? also please note down that dot (.) can also occur multiple... (12 Replies)
Discussion started by: kashifv
12 Replies

7. Shell Programming and Scripting

Convert special charachter ^C to new line

Hi, I have a file, which contains ^C or ^A characters from mainfrme system, it's dec 192 or octal 300 hex C0. I want to replace this character with new line. I used commands, but it didn't worked. tr '\o300' '\n' <t >t2 #or tr '\xC0' '\n' <t > t2 Can somebody help me to do... (2 Replies)
Discussion started by: vnag97
2 Replies

8. Linux

clear in Linux ksh

Clear in Linux #!/usr/bin/ksh am using clear in the script, but it is not working, it gives an error as follows, 'xterm': unknown terminal type. please help out.:confused: ---------- Post updated at 01:19 PM ---------- Previous update was at 12:01 PM ---------- if then ... (2 Replies)
Discussion started by: pradebban
2 Replies

9. Linux

LINUX Cron Schedule - Newline character issue

we have one simple script that works fine as expected while running it manually. However, it does not work the way it should be when scheduled through CRON. Script: a="Perform" b="Test" output="$a\n$b\n" echo "$output" while executing the above script, it should print the values of a and b... (2 Replies)
Discussion started by: jansat
2 Replies

10. UNIX for Dummies Questions & Answers

ksh on UNIX and Linux

Hello, Would the same version of Korn Shell (let's say ksh93) would use the same syntax on UNIX and LINUX and work exactly the same? Thanks (3 Replies)
Discussion started by: rdogadin
3 Replies
Locale::Codes::LangFam(3)				User Contributed Perl Documentation				 Locale::Codes::LangFam(3)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-02-27 Locale::Codes::LangFam(3)
All times are GMT -4. The time now is 11:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy