ɹəuəllıʍ ʇɐb Posted April 6, 2006 Report Share Posted April 6, 2006 I have two files (program source code); one is the older version, and one is the newer version.I need to know what exact changes were between the two versions. When I use diff to compare the two, each line is flagged as different, although they seem identical.It didn't take me long to find that the older version had trailing blanks up to column 80 (these are files originating from IBM MVS and VSE systems).Question: is there an easy way to remove trailing blanks from a file under Unix?(For now I am going to download the files to Windows and try with Windiff; I think it ignores blank space). Quote Link to comment Share on other sites More sharing options...
scuzzman Posted April 7, 2006 Report Share Posted April 7, 2006 You can do this with sed:sed 's/[ \t]*$//' < filename > new_file_nameReplace filename with the name of the file, and new_file_name with the name of the file for it to output to. Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted April 7, 2006 Author Report Share Posted April 7, 2006 Absolutely brilliant - thank you! (Didn't use the < + > marks at first, and it did nothing. But with the marks it did exactly what I needed) Quote Link to comment Share on other sites More sharing options...
scuzzman Posted April 7, 2006 Report Share Posted April 7, 2006 No problem :)There is a really nice set of sed functions (in fact, command functions in general) here if you're interested :) Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted April 7, 2006 Author Report Share Posted April 7, 2006 Thanks for that link; bookmarked it. Never heard of sed before; I always use vi if I need to do any editing on Unix. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.