|
|
|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Issue with New Line character
Hi,
I am reading data from file and storing it in a multiline variable. Every line is seperated with "\n" character. globalstrval="${globalstrval}""${line}""\n" If the value of globalstrval is like: 1234 ABCD EFGH WXYZ .... If I do, YLvar=`echo $globalstrval | grep "ABC"` then it should return me only one line : ABCD, and it is working fine in AIX. But when I am porting my script on Linux system, I am getting value back as "1234\nABCD\nEFGH\nWXYZ". How can I get it working on both systems? I am using /bin/su. Is there any thing to do with shell? Any help is much appreciated. Thanks, - Ashish |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
Concatenate the strings like this, assuming you're using bash: Code:
globalstrval="${globalstrval}" $'\n' "${line}" |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Awk not working due to missing new line character at last line of file | pinnacle | Shell Programming and Scripting | 2 | 05-07-2009 10:51 PM |
| Need to serach if a new line character exists on the last line in a file | sunilbm78 | UNIX for Dummies Questions & Answers | 10 | 02-29-2008 02:15 PM |
| character spacing issue | wxornot | Shell Programming and Scripting | 1 | 03-08-2006 08:22 PM |
| delete a line based on first character of the line | borncrazy | UNIX for Dummies Questions & Answers | 2 | 12-06-2005 03:27 PM |
| Issue with dispaly of special character like 'TM' | vbehal | UNIX for Advanced & Expert Users | 0 | 11-13-2005 04:15 AM |
|
|