Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-26-2003, 03:41 PM   #1
Registered: Apr 2003
Posts: 87

Rep: Reputation: 15
find and \b

In the find manual, it says you can use \b in the -printf action to "Backspace", but it doesn't seem to be doing anything. What I wanted to do was get rid of the file extension when the filename is printed out. I know that the extensions are all 6 characters long, so I tried:

find . -name 'bleh*.*' -printf "%f\b\b\b\b\b\b\b\n"

What I had hoped this would do was, for example if it found "blehabc.123456", it would only print "blehabc", but it just prints "blehabc.123456"

What, then, is \b used for?

Last edited by brian0918; 06-26-2003 at 03:43 PM.
Old 06-26-2003, 04:33 PM   #2
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
The backspace doesn't, necessarily, remove a character, it moves the "cusor" back one space. If you do something like this:
find . -name 'bleh*.*' -printf "%f\b\b\b\b\b\b\b       \n"
You'll have what you want, visually. However, this just replaces the .123456 with
"^H^H^H^H^H^H^H          ".
If you redirect the output to a file and vi, emacs, or pico it, you'll see what I mean.

To get what you want, you need to pipe the output to another command like cut or awk:
fine . -name 'bleh*.*' -printf "%f\n" | cut -d"." -f1

Last edited by moses; 06-26-2003 at 04:34 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linux find to find files with multiple patterns subu_s Programming 6 12-15-2010 12:15 AM
Can`t find C-compiler in Debian ,or at least can`t find one that can make executables hemmelig Linux - Software 4 05-26-2008 03:07 AM
I can find the camera but can't find the images? sneckert Linux - Newbie 2 02-02-2005 08:51 AM
find: . changed during execution of find suse degraffenried13 Linux - General 3 12-12-2004 07:13 PM
linux 'find' to find text files subu_s Programming 2 12-02-2004 02:56 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration