-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_csv
executable file
·77 lines (66 loc) · 1.54 KB
/
read_csv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# author: John Jayson B. De Leon
# github: savjayalde84
case $1 in
#attempting to install
"--install_dependency")
#check if setting the autherition of the file is good
chmod +x install_dependecies.bash
if [ $? -eq 0 ]
then
echo "setting up..."
#check if the install is good
bash install_dependecies.bash
if [ $? -eq 0 ]
then
echo "attempt installing dependencies..."
else
echo "failed to attemp installing dependencies"
fi
else
echo "failed setup dependencies"
fi
;;
# print table using the less
"-l")
echo "Reading The File...."
cat $2 | tty-table | less
echo "Done Reading File..."
;;
# print table in the terminal
"-c")
echo "Reading The File...."
cat $2 | tty-table | cat
echo "Done Reading File..."
;;
#print table using more
"-m")
echo "Reading The File...."
cat $2 | tty-table | more
echo "Done Reading File..."
;;
#print table in the txt file
"-t")
echo "Reading The File...."
cat $2 | tty-table | csv.txt
echo "Done Reading File..."
echo "created csv.txt..."
;;
#show the about of this tools
"-v")
echo "author: john jayson b. de leon"
echo "github: savjaylade84"
echo "@version 1.0"
;;
#show the manual
"-h" | *)
echo "usage: ./read_csv [option] filename"
echo "example : ./read_csv -t data.csv"
echo "-t is for storing csv to txt"
echo "-l is for using less to view csv"
echo "-c is for using cat to view csv"
echo "-m is for using more to view csv"
echo "-v to view version and the author"
echo "--install_dependency to install all the dependency"
;;
esac