X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Date: Wed, 9 Dec 2009 16:57:49 -0800 From: Gary Johnson To: cygwin AT cygwin DOT com Subject: Re: How to print the full Windows path inside the sed command? Message-ID: <20091210005749.GD868@KCJs-Computer> Mail-Followup-To: cygwin AT cygwin DOT com References: <7abf96460912091409i3937fbd1kc3c597a3e8a9e79a AT mail DOT gmail DOT com> <4B2025D0 DOT 8090301 AT bopp DOT net> <20091209234706 DOT GC868 AT KCJs-Computer> <7abf96460912091612h1852e1c0n2867864bbf737504 AT mail DOT gmail DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7abf96460912091612h1852e1c0n2867864bbf737504@mail.gmail.com> User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 2009-12-10, Chip Panarchy wrote: > On Thu, Dec 10, 2009 at 10:47 AM, Gary Johnson wrote: > > On 2009-12-09, Jeremy Bopp wrote: > >> Chip Panarchy wrote: > > > >> > Then I ran the following command from command-prompt; > >> > > >> > find2 . -follow -type f | sed -e "s|^\.|PATH|" -e "s|^|File:\t|" > >> > > >> > Is there a command (from Cygwin/Linux: PATH) which I can use to print > >> > the full directory path? > >> > > >> > Please tell me how I can make this command work. > >> > >> The default behavior of the find program is to print out paths including > >> the path to the directory you are searching.  In your case, you're using > >> the current working directory (.), but you could give find the full path > >> instead.  You can run something like the following: > >> > >> find path/to/my/directory -follow -type f | sed -e "s|^|File:\t|" > >> > >> All file paths printed by this will have path/to/my/directory included > >> so there is no need to have sed try to replace (.) with some other path > >> string. > > > > In addition to all that, if you're trying to convert between Cygwin > > full path names and Windows full path names, use cygpath. > How do I put cygpath -ma in the command instead of 'PATH'? find path/to/my/directory -follow -type f | cygpath -ma -f - | sed -e "s|^|File:\t|" > Also, is there a way to add a trailer (currently just a header to each line) sed -e "s|$|\tTrailer|" Regards, Gary -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple