To create a pipe symbol (|) separated values file containing data from all of the files in a directory with names ending in .log, you could use the following:
If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
If there are files named 2015-08-14_hostname_cpu.log and 2015-08-15_hostname_cpu.log in a directory where you run the above script and each of those files contained the sample data shown in your 1st post in this thread, it produces the output:
I will leave it to you to redirect the output from the above script into a file you can use to load your database or pipe the output directly into a mysql statement to load your database.
This User Gave Thanks to Don Cragun For This Post:
Hi....can you guys help me out in this script??
Below is a text file script....called Bukom.txt and it contains these:
BUKOM 20060101 2.5 2.6 2.7 2.8 2.9 2.3 2.1
BUKOM 20060102 2.4 2.5 2.6 2.7 2.7 2.6 2.4
BUKOM 20060103 2.1 ... (9 Replies)
Hi,
Need to get help from you guys about this issue.
I need to insert data into MySql database from a text file which is located in other server.
The text file is something look like below:
Date | SubscriberNo | Call Duration
20/7/07 | 123456788 | 20
20/7/07 | 123412344 | 30
The... (4 Replies)
Hi....can you guys help me out in this script??
Below is a text file and it contains these:
GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005675 000001... (4 Replies)
Hi All,
I have a file like this,
data1,data2,,,data5,data6.
i want to write a shell script to replace data3 with "/example/string". which means my data file should look like this .
data1,data2,example/string],,data5,data6.
Could you guys help me to get a sed command or any other command... (8 Replies)
Hi Guys
I need to have a shell script which reads a log file and insert a part of each line into the database. Some sample lines in the file are as below.
20091112091359 MED_RQACK : user_data=60173054304,100232120,20091112091359,;ask_status=0;ask_reason=OK;msg_id=20091112091319... (5 Replies)
If you have a text file and if you want to Insert data to your Database Table, You can do it with these queries
LOAD DATA LOCAL INFILE '/path/yourTextFile.txt' INTO TABLE yourTableName
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n' (0 Replies)
Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database.
I need to write the korn shell program on Red Hat Enterprise Linux server.
Oracle database is 10g. (15 Replies)
Hello All:
We are looking to search through 2000 files with around 21,000 statements where we have to search, replace and insert a pattern based on the following:
1) Parse through the file and check for CREATE MULTISET TABLE or CREATE SET TABLE statements.....and they always end with ON... (5 Replies)
I have a test file that I want to read and insert only certain lines into the
the table based on a filter.
1. Rread the log file 12 Hours back Getdate() -12 Hours
2. Extract the following information on for lines that say "DUMP is
complete"
A. Date
B. Database Name
C.... (2 Replies)
Hi Experts,
I have a situation where I need to write a shell script to continuously monitor a log directory with multiple log files and perform following:
1. Read the latest log file continuously and grep "Success" OR "Failure"
2. As it capture either Success or Failure, it has to perform a... (1 Reply)
Discussion started by: rish_max
1 Replies
LEARN ABOUT X11R4
rewinddir
REWINDDIR(3) Linux Programmer's Manual REWINDDIR(3)NAME
rewinddir - reset directory stream
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
void rewinddir(DIR *dirp);
DESCRIPTION
The rewinddir() function resets the position of the directory stream dirp to the beginning of the directory.
RETURN VALUE
The rewinddir() function returns no value.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+------------+---------------+---------+
|Interface | Attribute | Value |
+------------+---------------+---------+
|rewinddir() | Thread safety | MT-Safe |
+------------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
SEE ALSO closedir(3), opendir(3), readdir(3), scandir(3), seekdir(3), telldir(3)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
2015-08-08 REWINDDIR(3)