Bash: Howto force line feed AND carriage return in script?
location: ubuntuforums.com - date: May 19, 2009
I do have a bash script with several echo commands called like this:
echo -n "Hello World"
How do I format the echo line to force line feed AND carriage return after each command?
At the moment the echo output looks like this:
Code:
Hello World
Hello World
Hello World
Hello World
not what I had in mind...
Can I somehow combine /n oder /r to force line feed and carriage return in scripts or can I use ANSI / escape sequences?
form feed,new line and carriage return
location: linuxquestions.com - date: March 27, 2013
Hi,can anybody help me clarify the difference between a form feed,a new line and a carriage return ?
So appreciate.
Remove New Line or Carriage return from Text File
location: linuxquestions.com - date: September 28, 2007
I have been running a very successful script removing URLs (grep and cut) from emails from my ebay favorites. In the last week or so the width of the emails that I have been receiving has narrowed to the extent that the URL now falls over 2 lines:
Item title:=09Dragon 1/6 Scale MODERN British SA80 Rifle MDRW0020
Item URL: http://cgi.ebay.co.uk/ws/eBayISAPI.d...m=3D130156919=
207&ssPageName=3DADME:B:SS:UK:1
Buy It Now price: =A36.99
Postage: +=A31.69
End time: 04-Oct-07 21:58 BST
The current script just pulls off the 1st line and the subsequent wget errors out.
I have tried awk, sed and tr in an attempt to remove the = sign and then the NL or CR. The = signs is easy but I am not having any luck joining the two lines up. I'm guessing that it is just an NL or CR. In vi or gedit it is not a problem to remove the NL or CR.
Any pointers please.
DIMonS
remove carriage return in bash script, or ignore it when using mv / mkdir
location: linuxexchange.com - date: April 16, 2011
hey guys,
i am trying to create a directory from a variable that comes from grep'ing and it keeps failing, telling me there is a carriage return where there isn't. i have tried dos2unix, it tells me it is an invalid file. i created the script on ubuntu 10.10 with gedit and unix line endings.
i have also tried piping the output of the cat'd file to
tr -d '\r'
that doesn't do it.
here is the part of the script which its failing on:
ARTIST=`cat read | grep DTITLE | cut -c8- | cut -d"/" -f 1`
ALBUM=`cat read | grep DTITLE | cut -c8- | cut -d"/" -f 2 | awk '{gsub(/^[ \t]+|[\t]+$/,"")};1'`
mkdir $DEST/"$ARTIST"
cd $DEST/"$ARTIST"
mkdir "$ALBUM"
mv $DEST/temp/*.flac $DEST/"$ARTIST"/"$ALBUM"/
and the error i receive:
mv: target `Hard\r' is not a directory
here is the file "read" that it is pulling from:
macmini:~/Dropbox/bin$ cat ~/Desktop/temp/read
210 folk 0d021f02 CD database entry follows (until terminating `.')
# xmcd CD database file
#
# Track frame offsets:
# 150
# 1
What's the best CRLF (Carriage Return Line Feed) handling strategy with git?
location: linuxexchange.com - date: January 19, 2015
I tried committing files with CRLF-ending lines but it failed.
I spent a whole work day on my Windows computer trying different strategies, and was almost drawn to stop trying to use git and instead try mercurial.
Please share only one best practice per answer.
IMAP connection carriage return line feed issue from linux?
location: linuxexchange.com - date: April 5, 2012
I'm attempting to connect to our exchange server using Mail::IMAPClient but a script that was working is having issues when I moved it from a temp dev desktop running ubuntu to a new dev env running centos. During that time I found out the exchange server was upgraded I think to 2010. Is there a setting in exchange that would allow commands to be processed with just linefeeds instead of requiring crlf or could this be a local system (running the script issue)?
This just times out after a while.
$openssl s_client -connect myhost.mydomain.net:993
...
* OK The Microsoft Exchange IMAP4 service is ready - 'myhost'
? login username password
* BYE Connection is closed. 13
read:errno=0
Commands would function correctly.
$openssl s_client -crlf -connect myhost.mydomain.net:993
...
* OK The Microsoft Exchange IMAP4 service is ready - 'myhost'
? login username password
? OK LOGIN completed.
? select inbox
* 4 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK
Gvim under microsoft windows Carriage return / Line Feed
location: ubuntuforums.com - date: July 8, 2010
I am using gvim under microsoft windows in my office and under ubuntu in my home. When I use gvim under microsoft windows, it adds Carriage Return / Line Feed at the end of each line. This is the default configuration. I want gvim to insert only linefeed characters (linux line ending) even if I am using it under windows.
There are tools to strip the extra CR characters. But I don't want to run these programs every time. I want gvim to start automatically in linux line ending mode (by modifying _vimrc file). How to do that?
Line feed or carriage returnlinefeed? Aka \n or \r?
location: linuxquestions.com - date: January 19, 2012
Hi: I have a text file, file1.txt with Unix style line terminators, which are simply line feeds (LF, ascii code 0x0a), aka newlines in C jargon. It's a plain ascii file. I have had to attach it to a post I posted in a forum where the users are predominantly Windows users but, ay, there's the rub, there can be Unix/Linux users too.
For the thing is that in the DOS/Windows environment, the standard is carriage return (CR, ascii code 0x0d) followed by line feed as a line terminator (I beg your pardon for my language which is a bit technical but in what subforum was I to speak about Windows?) Therefore, I seem to be in a cul de sac, for I cant know, before hand, who is going to click on the attachment link in the post, a Unix user or a DOS/windows one? I.e., do I use Unix style or DOS style in the file file1.txt?
The behaviour in a DOS/Widows editor is to ignore the LFs and the result is a very long line which is impractical to read.
This must be a trivial problem for an average linux u
[SOLVED] bash: echo $variable without carriage return
location: linuxquestions.com - date: January 11, 2014
When doing the following in bash: (perhaps other shells too?)
Code:
[SOLVED] bash: echo $variable without carriage return Page 2
location: linuxquestions.com - date: January 12, 2014
Hmm.. Then are you sure you don't have something in your ~/.bashrc or similar startup script?
Try creating a fresh user (or, hell, try while beeing root -- just be sure it's a login shell, so do "su - root", or "sudo bash --login") and see if the JAVA_HOME variable still has problems.. The point is to pin-point if it's a system-wide script problem or just some script that gets executed when you login..
please wait...
Page: 1 2 3 4 5 6 7 8 9 10