Timeline for Concatenating txt files and keeping directory name
Current License: CC BY-SA 4.0
29 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Feb 28, 2023 at 23:27 | vote | accept | linuxuser24569 | ||
| S Feb 28, 2023 at 23:27 | vote | accept | linuxuser24569 | ||
| S Feb 28, 2023 at 23:27 | |||||
| Feb 28, 2023 at 23:26 | vote | accept | linuxuser24569 | ||
| S Feb 28, 2023 at 23:27 | |||||
| Feb 28, 2023 at 21:05 | history | edited | linuxuser24569 | CC BY-SA 4.0 |
added 154 characters in body
|
| Feb 28, 2023 at 20:44 | history | edited | linuxuser24569 | CC BY-SA 4.0 |
deleted 648 characters in body
|
| Feb 28, 2023 at 15:49 | answer | added | Marcus Müller | timeline score: 2 | |
| Feb 27, 2023 at 23:06 | answer | added | linuxuser24569 | timeline score: -1 | |
| Feb 27, 2023 at 23:04 | comment | added | linuxuser24569 | Thanks a million! | |
| Feb 27, 2023 at 22:59 | comment | added | Valentin Bajrami |
Well you can use -iname or if it is a matter of File or file then '[Ff]ile?.txt' will work. Since find supports -iname just use that.
|
|
| Feb 27, 2023 at 22:56 | comment | added | linuxuser24569 | Perfect, this worked! Last thing, how can I have the command ignore case? Some file names might be file.txt and some might be File.txt | |
| Feb 27, 2023 at 22:49 | comment | added | Valentin Bajrami | See: i.imgur.com/4Cw7Cp2.png | |
| Feb 27, 2023 at 22:44 | comment | added | linuxuser24569 | That is interesting because within terminal I am in the directory 'test'. within 'test' is 'dir1' and 'dir2', each of those have a couple subdirectories and then a file called file.txt. i made this just for testing. anyways, when i run the command it only concatenates the data from dir1 and shows nothing from dir2. what am i doing wrong? | |
| Feb 27, 2023 at 22:31 | comment | added | linuxuser24569 | Hey Valentin, this worked except it only showed the first directory. I have dir1 and dir 2. How can I get it to show from all directories/subdirectories? Also, how can i have this output to a file? | |
| Feb 27, 2023 at 22:28 | comment | added | linuxuser24569 | Yes, I am sorry. I am just trying to wrap my head around some of the answers and created a test directory to see if the answers are helping. | |
| Feb 27, 2023 at 22:26 | comment | added | linuxuser24569 | I added an update to my original question. I wonder if it's possible to work off of that command? | |
| Feb 27, 2023 at 22:24 | history | edited | linuxuser24569 | CC BY-SA 4.0 |
added 381 characters in body
|
| Feb 27, 2023 at 22:15 | answer | added | Chris Davies | timeline score: 1 | |
| Feb 27, 2023 at 21:51 | comment | added | Kusalananda♦ | I notice that you have asked several questions but have yet to accept any of the answers you have received. Consider accepting the most helpful answers to each question. Doing so will mark the issue as resolved and increase your chances of getting help in the future. See also unix.stackexchange.com/help/someone-answers | |
| Feb 27, 2023 at 21:32 | comment | added | Freddy | Wouldn't it make sense to add the complete path to each file if you have thousands of files? | |
| Feb 27, 2023 at 21:22 | answer | added | ralz | timeline score: 0 | |
| Feb 27, 2023 at 21:16 | comment | added | linuxuser24569 | they all share the same name. I would concatenate by doing: cat filename.txt > filename_merged.txt for example | |
| Feb 27, 2023 at 21:15 | comment | added | ralz | how are you choosing which files are concatenated, are you entering directories by hand, or are you going throug some loop and running cat command or something else on a path, if you are entering directories by hand you can use pwd command with output to file and then concatenate with >> to file to append to a file that has the path on top. If you are using some loop you can write the path you are entering to top of the file and then append with >> to the same file the concatenation | |
| Feb 27, 2023 at 21:07 | comment | added | linuxuser24569 | Hopefully I explained it better in the edit. | |
| S Feb 27, 2023 at 21:05 | history | edited | Gilles Quénot | CC BY-SA 4.0 |
added 92 characters in body
|
| Feb 27, 2023 at 21:05 | review | Suggested edits | |||
| S Feb 27, 2023 at 21:05 | |||||
| Feb 27, 2023 at 21:04 | history | edited | linuxuser24569 | CC BY-SA 4.0 |
added 2 characters in body
|
| Feb 27, 2023 at 21:04 | history | edited | linuxuser24569 | CC BY-SA 4.0 |
added 729 characters in body
|
| Feb 27, 2023 at 20:55 | comment | added | Peregrino69 |
Do you mean you want to see the directory name on top of the contents of each file? Can you edit the question to clarify? Maybe add example output enclosed in code brackets { } to preserve the formatting.
|
|
| Feb 27, 2023 at 20:50 | history | asked | linuxuser24569 | CC BY-SA 4.0 |