Tag Archives: text

View carriage returns, line feeds and tabs within text files

This is a useful Python one-liner for viewing characters that are usually hidden in text files;

  • Carriage returns (shown as \r)
  • Line feeds (shown as \n)
  • Tabs (shown as \t)
python -c "f = open('filename.txt', 'r'); f.seek(0); file = f.readlines(); print file"

Example output:

['Carriage return and line feed: \r\n', 'Line feed: \n', 'Tab: \t\n']

I recently used this script when trying to work out why a shell script was not executing correctly on a Debian machine — the reason was some carriage returns inserted by a Windows-based editor.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

New BBEdit Search and Replace Window

One of the new features of BBEdit 9 is the new Find/Replace Window, shown below:

BBEdit search and replace window

It’s been simplified a lot since the last version, but the really big change is that it is now a modeless window. This means that the Find/Replace window can be left open whilst still allowing interaction with document windows. Initially, this seemed like a good feature to me before I realised a side-effect of this change: there are no keyboard shortcuts for the Find/Replace options anymore. You can see the difference by looking at the old Find/Replace window:

BBEdit search and replace window

In this example, the Command key is being held down to illustrate which shortcuts are available; for example, Command-G toggles the Grep support.

Because of the Modeless window, these shortcuts have been lost in BBEdit 9. This makes the Find/Replace window slightly more cumbersome to use as turning on search options now requires the mouse. Furthermore, the very useful Start At Top option, has been removed completely.

Update: Thanks to Rich Siegel, CEO of Bare Bones Software, who has pointed me towards the release notes which document some brand-new Find shortcuts, thus rendering this blog post mostly pointless. Hurrah!

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn