i am dealing many lines containing paths example :
posterita/posterita/web/jsp/pos/posReport1.jsp
build/web/view.jsp
uPortal-webapp/src/main/webapp/WEB-INF/flows/user-manager/selectUserAction.jsp
config/auth.php
database/seeds/DatabaseSeeder.php
admin/modules/announcement/functions.inc.php
what i need to do using bash print the first directory I want the output to be like
posterita
build
uPortal-webapp
config
database
admin
the same method with second and third directory
posterita
web
src
seeds
modules
How can i use awk , sed or cut to do this ?
$ awk -F'/' -v n=1 'NF>n{print $n}' file
posterita
build
uPortal-webapp
config
database
admin
$ awk -F'/' -v n=2 'NF>n{print $n}' file
posterita
web
src
seeds
modules