In my rails 4.x app on a Mac, I call rake routes, and I get the following output:

**Raw output (without awk):**

```
> bundle exec rake routes
Prefix Verb   URI Pattern    Controller#Action                                                  
new_user_session GET    /users/sign_in(.:format)           devise/sessions#new                                       
                 PATCH  /users/password(.:format)          devise/passwords#update
new_api_user_session GET    /api/auth/sign_in(.:format)    devise_token_auth/sessions#new {:format=>:json}

```

I want to call rake routes, but output only the last two columns (URI Pattern and Controller#action). It is also a fact that the last two columns begin with a '/', while the first two columns never have a '/'.

**Desired output:**

```
> bundle exec rake routes | awk 'something'
URI Pattern    Controller#Action                                                  
/users/sign_in(.:format)           devise/sessions#new                                       
/users/password(.:format)          devise/passwords#update
/api/auth/sign_in(.:format)    devise_token_auth/sessions#new {:format=>:json}

```

I tried these approaches:

**Approach 1:**

```
> bundle exec rake routes | awk '{print $(NF-1),"\t",$NF}'
Pattern      Controller#Action
/users/sign_in(.:format)           devise/sessions#new                                       
/users/password(.:format)          devise/passwords#update
devise_token_auth/sessions#new     {:format=>:json}

```

The first two rows (/users/sign\_in and /users/password) work fine, but the third one treats devise\_token\_auth/sessions#new and {:format =>:json} to be separate columns, due to default field separator being space. Also, for the same reason, the header row chopped out the word URI from URI Pattern. 

**Approach 2:** 

```
> bundle exec rake routes | awk '{$1=""; $2=""; print}'
URI Pattern Controller#Action
/users/sign_in(.:format)           devise/sessions#new                                       
devise/passwords#update
/api/auth/sign_in(.:format)    devise_token_auth/sessions#new {:format=>:json}

```

In the second approach, it works fine for the first (/users/sign\_in) and third (/api/auth/sign\_in) rows, but it is messed up in the second row, because there is a blank first (prefix) column. 

**Approach 3:**

I also looked for a filter switch on rake routes, (Like the top command has -stats)? but in [the routes rakefile](https://github.com/rails/rails/blob/master/railties/lib/rails/tasks/routes.rake), I couldn't find any such option.

**Approach 4:**

The following approach works, but it uses a different fact about the data - that we need all the content beginning with the first '/':

```
# rake_awk

#!/usr/bin/awk -f
{   
  search="/";
  n=split($0,array,search);
  if(n == 1) {
   print "\n", $3, $4, "\t\t\t\t\t\t\t", $5, "\n";
  }
  else {
    for (i=2;i<=n;i++) {
        if (i < n) {
          printf("/%s", array[i]);
        }
        else {
          printf("/%s\n", array[i]);
        }
    }
  }
}

```

And from the command line:

```
> bundle exec rake routes | /path/to/rake_awk

URI Pattern                         Controller#Action

/users/sign_in(.:format)           devise/sessions#new                                       
/users/password(.:format)          devise/passwords#update
/api/auth/sign_in(.:format)        devise_token_auth/sessions#new {:format=>:json}

```