So I already use sed
to clean up certain key words and I use awk
to delete everything after a ?
, for example. But I have a file that looks like this.
Input:
/value1/value2/value3/morestuff
Desired output:
/value1/value2/value3
all values are not static, I can only key on the slashes.
I need to remove everything after value3
. Nothing is static except the number of slashes. Ideas?
Example of code:
cat $FILE | awk '/User/ {print $7,$9,$13}' | awk -F? '{print $1}' | sort --unique > $tempNAME
sed -i 's/with/ /g' $tempNAME
sed -i 's/trans.*se]//' $tempNAME
sed -i 's/trans.*st]//' $tempNAME
EDIT: clarified input/output