Parsing a the contents of a file

I have a file that has records like

ca_(en)/corporations/20161014f/filename
ct_(en)/20161014/Filename
ct_(en)/20161014/AnotherFilename
fl_(en)/20161014/FileName
fl_(en)/trademark/20161014/Filename.

What I am trying to do is to basically replace wget because we are losing access to ftp.

What I need is to create a file like
ca_(en)/corporations/20161014f
ct_(en)/20161014
fl_(en)/20161014
fl_(en)/trademarks/20161014

What I eventually will do is to use mkdir -p to build the complete directory structure and then sftp the actual data into those directories.

I tried using lftp with mirror, but it doesn’t quite get me there.

You can use “awk” command to accomplish your task. It is quite successful at these kind of jobs and it might be a little bit confusing sometimes. Actually, here is a tutorial page for you:

https://www.tutorialspoint.com/awk/

I’m not sure about that, I do not understand.

Do you generate a file in the specific format?

What do you want to do with the contents of this file?

AWK is great in processing text, I still use till today. It’s awesome.
https://likegeeks.com/awk-command/
Old is gold!!