Filtra o arquivo para listar todos os caminhos nele

0

Como posso filtrar o arquivo de texto para remover tudo e apenas deixar os caminhos nele? Por exemplo:

dslkjcblasdjncklasdnlc /asdds/ads/adss/sdf.jpg asljdascuashn sdkm
/sdf/dsf/dsf/dfs/sdfs.txt ,nbaskhdnasm.ddslkjcblasdjncklasdnlc
/asdds/ads/adss/sdf.jpg asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt
,nbaskhdnasm.ddslkjcblasdjncklasdnlc /asdds/ads/adss/sdf.jpg
 asljdascuashn sdkm /34/34/dsf/dfs/sdfs.txt
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /asdds/ads/adss/sdf.jpg
 asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /sd/df/fg/fgsdf.jpg asljdascuashn
 sdkm /sdf/dsf/34/dfs/sdfs.txt ,nbaskhdnasm.ddslkjcblasdjncklasdnlc
 /asdds/ads/adss/sdf.jpg asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /qw2/sd23/adss/sdf.jpg
 asljdascuashn sdkm /34/34/dsf/dfs/sdfs.png
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /asdds/ads/adss/sdf.jpg
 asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /wre/ads/adss/sdf.nii
 asljdascuashn sdkm /sdf/dsf34/dsf/dfs/sdfs.pmb
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /asdds/ads/adss/sdf.jpg
 asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /34/ads/34/sdf.jpg asljdascuashn
 sdkm /34/dsf/dsf/34/sdfs.dbt ,nbaskhdnasm.ddslkjcblasdjncklasdnlc
 /asdds/ads/adss/sdf.jpg asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt
 ,nbaskhdnasm.ddslkjcblasdjncklasdnlc /34/34/34/sdf.zip asljdascuashn
 sdkm /sd34f/dsf/dsf/34/sdfs.tar.gz ,nbaskhdnasm.d

como posso remover tudo e deixar apenas os caminhos para que eu tenha:

/asdds/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/asdds/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/asdds/ads/adss/sdf.jpg 
/34/34/dsf/dfs/sdfs.txt 
/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/sd/df/fg/fgsdf.jpg 
/sdf/dsf/34/dfs/sdfs.txt 
/asdds/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/qw2/sd23/adss/sdf.jpg 
/34/34/dsf/dfs/sdfs.png
/asdds/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/wre/ads/adss/sdf.nii 
/sdf/dsf34/dsf/dfs/sdfs.pmb 
/asdds/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/34/ads/34/sdf.jpg
/34/dsf/dsf/34/sdfs.dbt
/asdds/ads/adss/sdf.jpg 
/sdf/dsf/dsf/dfs/sdfs.txt 
/34/34/34/sdf.zip 
/sd34f/dsf/dsf/34/sdfs.tar.gz 
    
por Rui F Ribeiro 12.10.2018 / 18:49

1 resposta

2

Com a opção -o do GNU grep, e assumindo que os caminhos de arquivo são divididos em espaços:

grep -o '/[^ ]*' < input
    
por 12.10.2018 / 18:53