[p4] Removing end of line character from files in entire source tree

Stephen Vance steve at vance.com
Wed Jan 9 10:57:16 PST 2008


Thierry --

It depends on what you mean by "end of line character" and possibly what 
platform you're on.

If you want a portable way that just uses Perforce, just change your 
workspace LineEnd property to a platform that removes the character 
you're interested in removing. For example, if you have Windows files 
that have CR-LF and you want to remove the CR, check them in on Windows 
with either "local" or "win" and then change the LineEnd to "unix" and 
force sync them. Similarly, use "mac" to remove the LF. You won't be 
able to remove both that way, though.

If you want to remove them entirely and you're on a Unix-like system or 
you have Cygwin on windows, do something like

tr -d '\r' < infile > outfile; mv outfile infile

Depending on where the file is, you may need to 'p4 edit' the file first 
or otherwise change permissions. Depending on your shell, you may also 
need to escape the backslash.

Steve

Thierry Lam wrote:
> I current have a depot with all source files ending with the end of line character, is there an easy way to remove them?
>
> Thierry
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>   

-- 
Stephen Vance
www.vance.com


More information about the perforce-user mailing list