i am new to unix shell scripting, could someone please help me. i was asked to develop a unix script and requirement of the script is as follows:
1. In source directory, if any new files are being dropped by external system then an email should be sent out with a message saying "files are available for further processing".
2. Generate for a string in each *.XML file and get the count of next to each XML file name
format should be:
3. if count of string occurrence in XML file is less than 7, should be moved to rejected directory.
4. if count of string occurrence in XML file is equal to 7, should be moved to processed directory.
5. after files are being moved to processed directory, files should be inserted in MYSQL database.
6.final validation, count of XML file name and no.of records which are inserted in MYSQL database should be matched.
Last edited by Don Cragun; 09-08-2014 at 10:04 PM..
Reason: Fix tags.
1) What mail utilities do you have available to you on the server in question?
2) Is there a single, particular string that you're trying to search for in the XML files? For example, maybe you are always looking for "BINGO", and so could use something like: $ grep -c BINGO <file>
3) Do you have credentials and table information for the DB?
So, a quick and naive stab at it that might give a starting point for 2-4:
There's no point to attempting #1 without more information about what's available on the server for sending emails. Similarly, we'd need to know about the MySQL DB in order to know about submissions to that.
thanks treeslouth,
need an output in the following format, could you please help me...
example:
Moderator's Comments:
CODE tags are crucial to make column alignment visible.
So you mention "list of matching string". Are there multiple strings that you're counting? For example, do you want to know how many times, in total, either "foo" or "bar" appear in an XML file?
Hi Experts,
I am writing a python script to grep string from file and display output in csv file as in attached screenshot
https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view
Input file(result_EPFT_config_device)
Below is the python script i have prepared as of... (1 Reply)
Hi,
OS: Redhat 7.5
shell: Bash
Wrote below script to login into oracle via shell script and trying to reset locked account..It works as expected. But I need specific output << EOF should go to target terminal not all out put
running below script from ansible command line..
#!/bin/bash... (1 Reply)
I have a ksh script that emails a report to outlook from a Unix Solaris. On server the report formatted perfectly. However, the email version the format is not.
On the server report looks like this:
TN Region Old SPiAD Server Order/Req Local Status NAAC Status Request Date New... (1 Reply)
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
how can I get the df -h command output into excel format or csv file.
df -k | tr -s " " | sed 's/ /, /g' | sed '1 s/, / /g' | column -t
df -h | column -t
I have tried as above but the format is not right. I'm not able to load the format into a excel or a table.
... (2 Replies)
Hi,
I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix.
My requirement here is that i want to do it automatically using a... (5 Replies)
Hi Guys,
I have a script for which the stdout and stderr should be redirected to a log file, they should not be printed on the screen. Could you please let me know the procedure to redirect the output of the script to a log file. Thanks in advance.
--- Aditya (5 Replies)
Hi,
I have a unix shell script that is outputting results from an SQL query to a *.csv file, using utl_file.put_line. The resulting file is then sent out via e-mail as a mail attachment.
The issue I have is that when the mailed attachment is opened in Excel the first column is shown as... (1 Reply)