shell
大大盒子
这个作者很懒,什么都没留下…
展开
-
shell脚本中的等于和不等于
shell中’等于’和’不等于’不能用’=‘或者’!=’例如判断 a时候等于a 和a是否等于b正确的代码如下a -eq a和a -ne b原创 2020-09-10 11:54:49 · 19677 阅读 · 0 评论 -
linux内crontab传时间参数
linux内crontab传时间参数15 4 * * * /home/temp/post_analysis/post_analysis_sqoop.sh $(date -d "1 day ago" +"\%Y-\%m-\%d")原创 2020-09-04 18:46:15 · 1449 阅读 · 0 评论 -
shell获取日期是当年中的第几周(中美式周)
实现语句#!/bin/shnum1=`date -d $1 +%U`num2=`date -d $1 +%V`echo "Start with Sunday as a week,"$1" week number is "$num1;echo "Start with Monday as a week,"$1" week number is "$num2;执行结果Start with Sunday as a week,2020-07-27 week number is 30Start with原创 2020-07-27 14:06:44 · 1797 阅读 · 0 评论 -
hive 模糊匹配 join之locate
locate基本用法locate(string substr, string str[, int pos])hive> select locate(‘a’,‘abcd’), locate(‘b’, ‘abcd’), locate(‘f’, ‘abcd’),locate(‘20’, ‘222002’)结果: 1 2 0 3join模糊匹配在这里插入代码片...原创 2020-06-02 14:24:56 · 1923 阅读 · 0 评论 -
shell中获取时间戳及时间戳和日期字符串之间的转化
shell中获取时间戳的方式为:date -d “$currentTime” +%s$ date -d @1337743485671 “+%c”Sun 28 May 44361 12:41:11 PM CST如果要将一个字符串 日期 时间戳之间的转化,方式如下:1、得到当前时间currentTime=date “+%Y-%m-%d %H:%M:%S”``2、将日期转为时间戳currentTimeStamp=date -d “$currentTime” +%secho $currentTim原创 2020-05-15 21:30:14 · 2505 阅读 · 0 评论