Hey Hackers and programers, what do you think about "BEST PROGRAMMING LANGUAGE"?
anyway, I love shell script. It's best to me.
why?
Command line editing is best interactive way.
look this site, Japanese firebase community web page, Community Member name(名前・プロフィール) and participation number of times(参加回数).
https://firebase-community.connpass.com/participation/
I want all of twitter IDs.
so, finally I write two command lines.
"seq ~" line is simple.
programming started from, this code is show all downloaded file.
cat ./page
I tried to show times and twitter ID
cat ./page|
awk '/.回./ || /.twitter.com./{print}'
It display twitter ID and participation number of times show. but lines display, accounts which no twitter community user too.(they go over 5 times but they don't have no github account, really?)
Anyway, other remove noise lines.
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js
Still remains no twitter account IDs problem.
I resolved by displaying only ID line and the line's after one lines
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"
Added seperater lines --, but I don't need this, so, remove this
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"
Still there are line number.but I thought, awk command is ignore noise columns. so,
bound two types of data(two lines)
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"|
sed '/a>$/N;s/\n/ /'
The goal seemed to horizon. awk command ignore noise columns, change the order of columns
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"|
sed '/a>$/N;s/\n/ /'|
awk '{print $( NF -1 ) " " $3}'
Remove noise characters.
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"|
sed '/a>$/N;s/\n/ /'|
awk '{print $( NF -1 ) " " $3}'|
awk '{gsub(/\//," ");gsub(/class=\"event\">/,"");print $1" "$NF}'
Just remove last of "
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"|
sed '/a>$/N;s/\n/ /'|
awk '{print $( NF -1 ) " " $3}'|
awk '{gsub(/\//," ");gsub(/class=\"event\">/,"");print $1" "$NF}'|
tr -d "\""
This is goal. I thought. Just in case, Duplicate Delete lines by "sort|uniq"
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"|
sed '/a>$/N;s/\n/ /'|
awk '{print $( NF -1 ) " " $3}'|
awk '{gsub(/\//," ");gsub(/class=\"event\">/,"");print $1" "$NF}'|
tr -d "\""|sort|uniq
There are any row(I don't know, any incorrect lines, haha). WTF!! I stopped thinking. anyway remove this. goodbye strange lines.
cat ./page|
awk '/.回./ || /.twitter.com./{print}'|
grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|
grep -A 1 -n "twitter.com"|
grep -v "--$"|
sed '/a>$/N;s/\n/ /'|
awk '{print $( NF -1 ) " " $3}'|
awk '{gsub(/\//," ");gsub(/class=\"event\">/,"");print $1" "$NF}'|
tr -d "\""|
awk '!/[0-9]/{next}{print}'
Just in case, sort|uniq and finally Output to a file
cat ./page|awk '/.回./ || /.twitter.com./{print}'|grep -v -e twitter.com/share -v -e 参加回数 -v -e widgets.js|grep -A 1 -n "twitter.com"|grep -v "--$"|sed '/a>$/N;s/\n/ /'|awk '{print $( NF -1 ) " " $3}'|awk '{gsub(/\//," ");gsub(/class=\"event\">/,"");print $1" "$NF}'|tr -d "\""|awk '!/[0-9]/{next}{print}'|sort|uniq > ./get_firebase_community_twitter_user_and_join_the_number_of_times.txt
I got a result!!
Do you think this is sloppy?
No, I don't think that.
Writing command line is no simulation results, no variable, no loop statement, and no editer.
You get best of interactivity.
Reading shell script is sucks. I think so that.
Writing command line is great, good experience is more than REPL.
I will continue to write shell program.
Top comments (0)