Dear community,
I have a very simple question, but I cannot figure out how to solve.
I have a simple string containing the carriage return or line feed at the end:
Now if I want to remove the CR I can use:
Because the $var should be reported on a file, togheter with other values, how can I remove the CR directly on the $var?
I tried:
But it's not working....
---------- Post updated at 10:42 AM ---------- Previous update was at 10:34 AM ----------
Wait, let me explain better. I have a file (info.tmp) like this:
I need to extract the INFO row, but with the following command I extracted also the Carriage Return:
So, how can I remove the CR from $var ??
I think some of the suggestions posted before mine will solve your problem, but if you want to know why
isn't working it's that you must use double quotes:
but on the other hand I'm not sure exactly what it is you want to do, and what you mean with not working...
I use always CR trap before do anything for the txt files. No need to take care:CRNL or NL.
Or if bigger file, then maybe use tmpfile
Or remove CR in the command line
Hi Perl users,
I have another problem with text processing in Perl. I have a file below:
Linux Unix Linux Windows SUN
MACOS SUN SUN HP-AUX
I want the result below:
Unix Windows SUN
MACOS HP-AUX
so the duplicate string will be removed and also the keyword of the string on... (2 Replies)
Hi,
I have a file containing the DDLs of tables in a schema. From that I need to remove all the lines from a starting string till a specific string. Here is an example.
File1.txt
-------------
CREATE TABLE "SCHEMA1"."LKP11_TBL_USERS"
( "ID" NUMBER(8,0) NOT NULL ENABLE,
"USER_ID"... (3 Replies)
Hello,
I have below data in a file and i want to remove 0 in front every digit from 1 to 9
16
08
08
16
16
16
16
08
08
16
out put should be
16
8 (2 Replies)
Hi,
I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Hi,
All my source files are having the format of tar.gz . When we have loaded the data in our target output file, we are getting some characters also in our output file like this
Actual output is:
File1.dat000064400215140000315000000023001164575707100224730ustar|20110506
Expected... (2 Replies)
Hello Folks..
I need your help ..
here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly sed...here my string..
dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq
desired output is..
dwc2_dfg_ajja_dfhhj
it's a simple task with tail... (5 Replies)
This is the way
sed -i 's/home/$USER/.config/hello_there//g' /home/$USER/.gnomerc
But, as far as I saw you cannot add any "/" in the string you want to remove....
So, what should I do in order to remove this path (which contains "/") ?:confused: (7 Replies)
Hi.
for the following line:
Var1=${Array}
now Array has text as "{hello there}"
how do I remove the {} brackets before assigning the string to Var1?
Thanks. (3 Replies)
Hi,
I have a variable with contain "fl080114". I want only "080114" into an another variable.
input:
name="fl080114"
output:
nm="080114"
Please help.
Thanks in advance. (2 Replies)
I have a script that does ls -ltr > files. like this i have 10 ls -ltr. My file x has 10 different lines with yyyy.log. I need to use this file's contents but without log at the end and i am using this in a script. Hope it is clear. Help pls
Gundu (1 Reply)