I want to merge various files located in different folders into one folder.
Example I have 4 folders increment number example ( 1080 to 1084 ) where there is various files with the same name in each folder. Please I need to merge all files with the same name to other folder called 223.
Example
INPUT
folder 1
folder2
folder3
folder4
output
Thanks for your support and help
Dear jiam912,
I have a few to questions pose in response first:-
What have you tried so far?
What output/errors do you get?
Does the order of reading files matter? (ls or find & sort)
Does the order of the content matter? (Concatenate or sort)
What OS and version are you using?
What are your preferred tools? (C, shell, perl, awk, etc.)
What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?
There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.
We're all here to learn and getting the relevant information will help us all.
Provided "merge" means "concatenate", and source file is $jd.txt not $jd.rps
--
Consider rewriting your C-shell script to a shell script!
A shell script has increased robustness and allows a more efficient concatenation.
This User Gave Thanks to MadeInGermany For This Post:
I have modified my script and it works fine.. But As I no to good in scripts I, kindly can you see the script and try to check if there is something extra.
When I merge the files each file has header starting with "H" letter I would like to delete all lines ^H in all files but from line 50 to the end.. can you please give and advise how I can do this.
Some comments on your script (without entirely understanding what you're about):
- rm -fR mkdir FF_files doesn't work on mkdir; -f suppresses error output. (And, to save some chars typed, why not use tt=FF_files; rm -R $tt; mkdir $tt?)
- why not use seq $fsw $lsw instead of`awk 'BEGIN {for (i='$fsw';i<='$lsw';i++) printf ("%s\n", i) }'` ?
- the entire sequence of if blocks like
could be replaced - if I understand your logics correctly - by one single
, provided you define an associative array upfront:declare -A TYP=( [rps]=R [sps]=S [xps]=X [aps]=A [cog]=C [raw]=Obs ) (and you could use
to list all extensions in the for loop...)
- the sed '50,10000{/^H/d;}' $jd.xxx are not working on the right directory, and they could make use of $ext as well, and, why stop at line 10000 and not work through the EOF by using 50,$, and they print to the screen instead of a file, and you could issue them after all loops have finished.
Hi,
So i know we use cp -r as a basic to copy folders/files.
I would like this BUT i would like to show the output of the files being copied.
With the amazing knowledge i have i have gone as far as this:
1) find source/* -exec cp -r {} target/ \;
2) for ObjectToBeCopied in `find... (6 Replies)
Dear Gents,
Please I need your help... I need small script :) to do the following.
I have a thousand of files in a folder produced daily.
I need first to merge all files called. txt (0009.txt, 0010.txt, 0011.txt) and and to output a resume of all information on 2 separate files in csv... (14 Replies)
Hi,
My requirement is,there is a directory location like:
:camp/current/
In this location there can be different flat files that are generated in a single day with same header and the data will be different, differentiated by timestamp, so i need to verify how many files are generated... (10 Replies)
Hi,
I need a script/command to list out all the files in current path and also the files in folder and subfolders.
Ex: My files are like below
$ ls -lrt
total 8
-rw-r--r-- 1 abc users 419 May 25 10:27 abcd.xml
drwxr-xr-x 3 abc users 4096 May 25 10:28 TEST
$
Under TEST, there are... (2 Replies)
Hello again,
A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x.
I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Hi, all:
I've got two folders, say, "folder1" and "folder2".
Under each, there are thousands of files.
It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command.
However, if I change the above question a... (1 Reply)
Hi Friends,
Below is my requirement and i am not clear how to approach this issue in unix programming.
I have a folder with 2500 files. The files are in below format.
1234_name1.txt
1234_name123.txt
4567_name1.txt
4567_name123.txt
and i need a program which will read each file from this... (5 Replies)
hi,
i am facing a problem in merging two files using awk,
the problem is as stated below,
file1:
A|B|C|D|E|F|G|H|I|1
M|N|O|P|Q|R|S|T|U|2
AA|BB|CC|DD|EE|FF|GG|HH|II|1
....
....
....
file2 :
1|Mn|op|qr (2 Replies)
Hi,
I had a directory and many subdirectories and files with in it.
Now i want to get the timestamp of files from the files and folders recursively. :(
Please help me to generate a script fort he above mentioned requirement!
Appreciate for ur qick response
Thanks in advance!
... (2 Replies)
Dear all,
I want to remove files older than 2 months in the /home/member directory. But except the configuration files (like .bash_profile .config/ .openoffice/ .local/ .kde/ etc..)
I have tried with the command
find . -mtime +60 -wholename './.*' -prune -o -print -exec mv {} \;
but it... (1 Reply)