Help With Shell Script

hello
i have a list of urs in this format

syilamerica.com/catalog/index.php?cPath=19

i want to sort them to for example . lelotusbleu.fr how can i do that? thanks

is this what you're after ?

#  sed 's#\([^/]*/[^/]*/\).*#\1#g' infile
lelotusbleu.fr/catalog/
syilamerica.com/catalog/
cat infile.txt | awk -F '/' '{print $1 "/" $2"/"}'

hmm... uuoc :-). Cleaner:

#  awk '{OFS=FS="/";print $1,$2 OFS}' infile
lelotusbleu.fr/catalog/
syilamerica.com/catalog/

NF needs to be set before the first line is read, otherwise the first line will not be processed corectly:

awk -F/ '{print $1,$2,x}' OFS=/ infile

Alternatively:

sed 's/[^/]*$//' infile

Or without the last /

awk -F/ NF-=1 OFS=/ infile