delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/09/17:34:04

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B2025D0.8090301@bopp.net>
Date: Wed, 09 Dec 2009 16:33:52 -0600
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: How to print the full Windows path inside the sed command?
References: <7abf96460912091409i3937fbd1kc3c597a3e8a9e79a AT mail DOT gmail DOT com>
In-Reply-To: <7abf96460912091409i3937fbd1kc3c597a3e8a9e79a@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Chip Panarchy wrote:
> Hello
> 
> First I copied: cygiconv-2.dll, cygintl-3.dll, cygintl-8.dll, find.exe
> (renamed to find2.exe) & sed.exe to the %WINDIR%.

Don't do that.  Install Cygwin using setup.exe and leave the files where
setup places them.  You're asking for so much trouble doing what you
did, and it gains you virtually nothing.  What are you trying to accomplish?

> 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.

-Jeremy

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019