Skip to content
Advertisement

Create files in subdirectories with the same name [closed]

Reading a list with A and B data in 2 columns, iterating row by row, I was createding a series of direcoties with the following logic. read first row, data A and B, create folder A and subfolder B ( mkdir -p A/B ) and so on. Well, now, I need to create a corresponding file B.txt ( i.e ) inside the proper subfolder B.

By example, y made some proofs with a single file with the next content.

JavaScript

I created the foler sructure with the next line:

JavaScript

The result was:

JavaScript

Now I would like to invoke that directory path, to move or create for example a file named b.txt to the directory with the same name, and so be able to do it with the whole tree, but I could not do it yet

My spected result.

JavaScript

Any idia?

Thanks

Advertisement

Answer

perhaps better to do in bash directly since there is nothing requires awk

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement