LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-26-2003, 04:41 PM   #1
brian0918
Member
 
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 04:43 PM.
 
Old 06-26-2003, 05:33 PM   #2
moses
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:
Code:
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
Code:
"^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:
Code:
fine . -name 'bleh*.*' -printf "%f\n" | cut -d"." -f1

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


Reply


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 01: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 04:07 AM
I can find the camera but can't find the images? sneckert Linux - Newbie 2 02-02-2005 09:51 AM
find: . changed during execution of find suse degraffenried13 Linux - General 3 12-12-2004 08:13 PM
linux 'find' to find text files subu_s Programming 2 12-02-2004 03:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 PM.

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