I have a lot CSV files that I have combined. However, there are duplicates, but the entire line is not duplicated. I do have a column that I want to use as the criteria to search for a duplicate.
How would I do the following command, with a local file, on a remote database (different machine) ?
$MYSQL_PATH/mysql -u root -h remote.net files -e "
LOAD DATA INFILE '$1'
INTO TABLE $TABLE_NAME
FIELDS TERMINATED BY ','
(size, @d2, @d3, @d4, @d5, path)
The problem seems to be that the INFILE at /tmp/infile.txt is not being recognized remotely.
I have a data file that has 14 columns. I cannot use awk or perl but sed is installed on my host. I would like to delete a line if fields 10, 11 or twelve is greater than 999.99. How is this done using sed?
I'm trying to load a csv file into mysql using the Load Data Local Infile command in the mysql workbench and I'm getting the errror.
ERROR 1148 (42000): The used command is not allowed with this MySQL version
I added the local-infile=1 line to the my.cnf file, but continue to get the error. Do I need to do something else to be able to load a csv file?
The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so:
Code:
print -n "Enter file name to split?
I have a large csv file that I want to break into smaller files
There is a title block, that does not share the index labeling of the rest of the file.
There is a labels line, that I want to separate out so I can call it for reports of each individual row in the content section, and there are 2 lines on the end that also do not share the indexing of the content section.
I have gotten this far, an
/*
* program accept argument from stdin as well as command line
* run it with
* echo "1 2 3" | ./a.out
* OR
* ./a.out 1 2 3
*/
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
int fromstdin = 0;
int i = 1;
char infile[200];
if (argc == 1) fromstdin = 1;
if (fromstdin)
{
memset(infile, 0, 200);
while (scanf("%s", infile) != EOF
I have some tab delimited data and I need to duplicate the second column. It seems like I should just be able to do something simple in awk like,
Code:
awk '{ print $1, $2, $2, $3 }'
(the second field is the one that needs to be duplicated)
but I'm not sure how to print from $3 to the end of the line ($3-$NF???) and I'm not sure how the tabs will be preserved.
LMHmedchem
Let's assume that infile contains a specific text, and I were to execute the following set of commands:
exec 3<infile
cat -n <&3
cat -n <&3
The first instance of cat will display the file's contents, but the second time does not seem to be doing anything. Why do they differ?