Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • So I tried this, but think I'm missing something.. here is what I did svn status | grep '\!' | gawk '{for (i=1; i<=$NF; i++)print $i " ";}' > removedProjs Commented Jun 2, 2010 at 21:35
  • Since print appends a newline, you'll want to buffer the results. See my edit. Commented Jun 2, 2010 at 21:53
  • 2
    I like this answer better because it shows how to loop through fields. Commented Jun 2, 2011 at 18:52
  • 3
    If you want print to use a space, change the output record separator: awk '{ORS=" "; for(i=2;i<NF;i++) print $i}' somefile Commented Apr 8, 2012 at 8:10
  • 6
    There will always be some spaces too much. This works better: '{for(i=11;i<=NF-1;i++){printf "%s ", $i}; print $NF;}' No leading or trailing spaces. Commented May 14, 2017 at 18:09