Shell commands: delete the last column, delete the first line, diff, and so on. delete the first line of the file: sed & amp; #39; 1d & amp; #39; filename: awk & amp; #39; {print $ NF} & amp; #39; two methods for comparing filename files: 1) comm-3 -- no... shell commands: delete the last column, delete the first line, diff, and delete the first line of the file: sed '1D 'filename delete the last column of the file: awk '{print $ NF}' two methods for comparing filename files: 1) comm-3 -- nocheck-order file1 file22) grep-v-f file1 file2: the output file2 contains rows not included in file1, and of course diff file1 file2 posts a shell script written yesterday ~ #! /Bin/bashdate_time = 'date + '% H _ % M _ % s' 'Yesterday = 'date-d "-1 day" +' % Y _ % m _ % d ''Today = 'date + '% Y _ % m _ % d' 'date _ day_time = 'date +' % Y _ % m _ % d _ % H _ % M _ % s' mkdir/home/spamdetect/changxiaojia/workspace/finance/logs/same_similiar_log/$ today # begin to get input files which haven'tbeen deal withtoday_input =/home/ crawler/petabyte/crawler LLOG/news_data/$ todayyesterday_input =/home/crawler/petabyte/crawler LLOG/news_data/$ yesterday/opt/hadoop/program/bin/hadoop fs-ls $ yesterday_input/ >/home/spamdetect/changxiaojia/workspace/finance/same_similar_news_mining/mid_files/all_get/opt/hadoop/program/bin/hadoop fs-ls $ today_input/>/home/spamdetect/ changxiaojia/workspace/finance/Workshop/mid_files/all_get sed '1D '/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/all_get>/home/spamdetect/changxiaojia/workspace /finance/users/mid_files/invalid awk '{print $ NF}'/home/spamdetect/changxiaojia/workspace/finance/same_similar_news_mining/mid_files/Documents>/home/spamdetect/changxiaojia/ workspace/finance/Workshop/mid_files/all_input # comm-3 -- nocheck-order/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/all_input/home/spamdetect/changxiaojia/ workspace/finance/Workshop/mid_files/input_done>/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/today_diff grep-v-f/home/spamdetect/changxiaojia/workspace/ finance/Workshop/mid_files/input_done/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/all_input>/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files awk '{print $ NF}'/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/today_diff>/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/ export mv/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/all_input/home/spamdetect/changxiaojia/workspace/finance/Workshop/mid_files/input_done # begin to compute finished = "" while read linedo inputfile1 = $ inputfile1, $ {line} done
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.