Sponsored Content
Top Forums Shell Programming and Scripting Read CSV file and delete hdfs, hive and hbase tables Post 303004882 by shivamayam on Wednesday 11th of October 2017 07:32:22 AM
Old 10-11-2017
CSV file name: interface.csv

HDFS - Hive - Hbase <<< CSV Header
/unix/win/filename1 - con_tag_incr - con_tag <<< row 1
/unix/win/filename2 - crm_tag_incr - crm_tag <<< row 2
/unix/win/filename3 - retail_tag_incr - retail_tag_incr <<< row 3

Please let me know, if you need more details and appreciate your help

---------- Post updated 10-11-17 at 06:32 AM ---------- Previous update was 10-10-17 at 09:19 AM ----------

#!/bin/bash
input="/home/username/interface.csv"
while IFS=',' read -r f1 f2 f3
do
echo "$f1 $f2 $f3"
hdfs dfs -rm -R /user/"$f1"/retail.csv
hive -f /home/username/droptable.sql
done < "$input"

Now I have to pass the DB_NAME and TABLE_NAME as parameters into the shell script.

DB_NAME's: CON, RETAIL, CRM

DROP TABLE IF EXISTS ${DB_NAME}.${TABLE_NAME};

Last edited by shivamayam; 10-11-2017 at 10:45 AM.. Reason: CSV file with rows and updated DB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[HELP] - Delete rows on a CSV file

Hello to all members, I am very new in unix stuff (shell scripting), but a want to learn a lot. I am a ex windows user but now i am absolutely Linux super user... :D So i am tryng to made a function to do this: I have two csv files only with numbers, the first one a have: 1 2 3 4 5... (6 Replies)
Discussion started by: Sadarrab
6 Replies

2. Shell Programming and Scripting

Read Csv file

Hi All, I need to check if a csv file is empty, leaving the first line as the first line is header pls help Thanks (3 Replies)
Discussion started by: gwrm
3 Replies

3. UNIX and Linux Applications

Does anybody know how to store my tables to a csv file?

Hi I'm using an oracle database... Lets call it databasename My username and password are the same .... lets all that andrea/andrea So I want to write a script to copy all the data from my table called tablename and store that data to a csv file called filename. I cant seem to get... (2 Replies)
Discussion started by: ladyAnne
2 Replies

4. Shell Programming and Scripting

read .csv file

Need UNIX script read below .csv file and print the line only records where type = TRN. Srno,Type,InputFileName,NewColumnData 1,TRN,File1.dat,11 2,TRN,File2.dat,12 3,TRN,File3.dat,13 4,REF,File4.dat, 5,REF,File5.dat, regards, santosh (4 Replies)
Discussion started by: santosh2k2
4 Replies

5. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

6. Shell Programming and Scripting

Read .csv file

Hello, this is my very first comment on this forum and i hope i don't mess it up. If i do, please forgive me (also for any language mistakes you may wanna know that i'm not native speaking). As i just started doing a bigger paper for my studies i got a bunch of data in seperate csv-files... (1 Reply)
Discussion started by: FabianDe
1 Replies

7. Shell Programming and Scripting

Writing Hbase and pig scripts in the bash script file

Hi, I have a script file where i'm validatig the input file and storing the validated records on HDFS. I wanted to load data from HDFS to HBASE using pig script. So for that i have created a HBASE table and written pig script to load data from HDFS to HBASE which is working fine. Now i wanted... (0 Replies)
Discussion started by: shree11
0 Replies

8. Shell Programming and Scripting

Splitting csv into 3 tables in html file

I have the data in csv in 3 tables. how can I output the same into 3 tables in html.also how can I set the width. tried multiple options . attached is the format. #!/bin/ksh awk 'BEGIN{ FS="," print "<HTML><BODY><TABLE border = '1' cellpadding=10 width=100>" print... (7 Replies)
Discussion started by: archana25
7 Replies

9. Programming

How to arhive hive external tables?

Hi Guys, Is there a way to check hive external tables which are created 90 days before and drop those tables along with underlying hdfs data. Can this be achieved in unix script? (10 Replies)
Discussion started by: Master_Mind
10 Replies

10. UNIX for Beginners Questions & Answers

Shell Script to read hive table and send email

HI Team, I am working on reading hive table and send email in email body using shell script, can you please help on fixing the errors: I have 6 columns in my hive table and trying to send the email in the mail body. below script: #!/bin/bash hive -e 'SELECT count(*) from db.table' >... (4 Replies)
Discussion started by: Mi4304
4 Replies
reglookup(1)															      reglookup(1)

NAME
reglookup-recover - Windows NT+ registry deleted data recovery tool SYNOPSIS
reglookup-recover [options] registry-file DESCRIPTION
reglookup-recover attempts to scour a Windows registry hive for deleted data structures and outputs those found in a CSV-like format. OPTIONS
reglookup-recover accepts the following parameters: -v Verbose output. -h Enables the printing of a column header row. (default) -H Disables the printing of a column header row. -l Display cells which could not be interpreted as valid registry structures at the end of the output. -L Do not display cells which could not be interpreted as valid registry structures. This is the default behavior. -r Display raw cell contents for cells which were interpreted as intact data structures. This additional output will appear on the same line as the interpreted data. -R Do not display raw cell contents for cells which were interpreted as intact data structures. This is the default behavior. registry-file Required argument. Specifies the location of the registry file to read. The system registry files should be found under: %System- Root%/system32/config. OUTPUT
reglookup-recover generates a comma-separated values (CSV) like output and writes it to stdout. For more information on the syntax of the general format, see reglookup(1). This tool is new and the output format, particularly the included columns, may change in future revisions. When this format stablizes, additional documentation will be included here. EXAMPLES
To dump the recoverable contents of a system registry hive: reglookup-recover /mnt/win/c/WINDOWS/system32/config/system Extract all available unallocated data, including unparsable unallocated space and the raw data associated with parsed cells in a user-spe- cific registry: reglookup-recover -r -l '/mnt/win/c/Documents and Settings/user/NTUSER.DAT' BUGS
This program has been smoke-tested against most current Windows target platforms, but a comprehensive test suite has not yet been devel- oped. (Please report results to the development mailing list if you encounter any bugs. Sample registry files and/or patches are greatly appreciated.) This program is new as of RegLookup release 0.9.0 and should be considered unstable. For more information on registry format details and the recovery algorithm, see: http://sentinelchicken.com/research/registry_format/ http://sentinelchicken.com/research/registry_recovery/ CREDITS
This program was written by Timothy D. Morgan. LICENSE
Please see the file "LICENSE" included with this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more details. SEE ALSO
reglookup-timeline(1) reglookup-recover(1) File Conversion Utilities 8 March 2010 reglookup(1)
All times are GMT -4. The time now is 04:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy