I need some suggestions on how to write the code to copy multiple files rather than duplicating the code multiple times.
Example: I have four files that need to go throught this logic in the same way. Do I have to duplicate this chunk of code four times or can I built the logic in the same set of code without copying and pasting the code four times with different file names?
Please advice...
This is what the code does for one file....
1) copies the file from one directory to another
2) Strips when the date part from the ll command and writes to the log
3) Counts the number of records in the file and writes to the log
4) If record count is less than 1, it exits with an error code
In step 3, I am not sure if cat is the most effective way to do a wc -l.
I did create a filename with the list of files that need to be copied...But I don't see much of a change in code because I am getting a count of records for each file and also using AWK to print the date part and then writing it to the log...
I am just trying to find an efficient way to write the code.
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Hi All
I am using GNU/Linux
This is regarding the get command to retrieve files (filename with wild card characters) from remote server.
I thought Get command can retrieve only 1 file irrespective of the files it has on the remote server And it is the function of mget to retrieve all... (7 Replies)
I am trying to find out which files in a group of files have lines ending in r. What I have is this:
cat /tmp/*RECORDS| if grep r$>/dev/null; then echo "yes";else echo"no";fi
Records is more than one file. There are the following files
TEST-RECORDS
/volume/testing
/volume/programs
... (2 Replies)
Hello,
I want to gzip some files before copying to remote host. There is no freespace on source host so it needs to be perfomed within one-liner. I tried the following but it didn't work
gzip -c -9 all_rvds.xml |ssh targethost "dd of=/tmp/all_rvds.xml.gz"
cat all_rvds.xml |gzip -c9 |ssh... (5 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi All,
I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations:
1. I am restrained to 2 input files only.
2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Hello,
I am trying to figure out how I can write a bashscript that compiles several ".c" files that start with xxx (example: xxx_try.c and xxx_that.c)
So I want to compile all these files with a bash script. Anyone can help pls? (6 Replies)
I'm using wget 1.11.4 on Cygwin 1.5.25.
I'm trying to recursively download a directory tree, which is the root of a javadoc tree.
This is approximately the command line I tried:
wget -x -p -r http://<host>/.../apidoc
When it finished, it seemed like it downloaded... (0 Replies)
Hi Masters,
Iam new to this Forum and this is my first post.
My question is:
I've some datafiles belongs the type (A, B, C) in the location 'export/home/lokiman '
dataA1.txt
dataB28.txt
dataC35.txt
1) I've to check the read permission for each file, if it not there then I've to... (1 Reply)
Hi,
Within a shell script I'm trying to copy all the files in a directory structure to another folder but only the files of type "pdf"
I have made a start but I can't work out how to finish it.
find $ATEBUILD/doc/user -name "*.pdf" | xargs cp THEN WHAT?
I hope this makes sense!
Rob (6 Replies)