The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-18-2009
ddrew78 ddrew78 is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 8
Find line before blank

Hello,

I actually have two issues. First, here is the file the way it is now.

someword someword:1
new-word new-word abcd
someword someword:10
new-word new-word abcd
thisis whatIneed:3


someword someword:5
new-word new-word abcd

I need to get the line before the 2 blanks and move it to a different file. I've tried using sed, but keep getting error messages. Also, there may be none, one, or several instances of this within the file.

I should probably also mention that this is part of a larger perl script I'm working on. I have everything else done, the file above is actually generated by the script. I also have everything below it complete, but am completely stuck at this point.

Any help with either would be appreciated.

Last edited by ddrew78; 03-18-2009 at 07:43 PM..