0

in file ~/x,

--- //zep/arod/jo/new/ded/main/changes 2013-05-13 17:14:34.000000000 -0700
--- //zep/arod/jo/new/ded/main/lib/soph/tool.py 2013-05-16 14:14:34.000000000 -0700
--- //zep/arod/jo/new/ded/main/lib/soph/pomp.py 2013-05-16 14:14:34.000000000 -0700

in c shell,

set F=`grep '^---' ~/x | cut -d/ -f7-99 | cut and somehow cut number`

then, ls $F should give

ded/main/changes
ded/main/lib/soph/tool.py
ded/main/lib/soph/pomp.py

I dont quite understand the -f tag and not sure how to cut the timestamp part

any suggestions?

ealeon
  • 12,074
  • 24
  • 92
  • 173
  • 1
    Somehow `awk '/^---/{ sub(/\/\/zep\/arod\/jo\/new\//,""); print $2 }' ~/x` seems more straightforward. – tripleee Aug 14 '13 at 17:35
  • yes i was looking into either awk or sed but i am really not familiar with those. @tripleee but ill stick with grep and cut for now – ealeon Aug 14 '13 at 17:43

1 Answers1

2

-f7-99 means "include fields 7 through 99" (which in this case, they probably just meant -f7- which would give all fields 7 and up).

cut divides each line up into fields, based on the divider (which is what -d/ is specifying - the divider in that case is the / character). It then returns the fields that you ask it for (in your example, 7 through 99).

Your second cut command could probably be cut -d' ' -f1 which would use a divider of spaces and only give you the first field (in other words, everything before the first space, which would be just the path).

Amber
  • 507,862
  • 82
  • 626
  • 550