File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
s0193_valid_phone_numbers Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 1+ # Read from the file words.txt and output the word frequency list to stdout.
2+ sed -e ' s/ /\n/g' words.txt | sed -e ' /^$/d' | sort | uniq -c | sort -r | awk ' {print $2" "$1}'
Original file line number Diff line number Diff line change 1+ # Read from the file file.txt and output all valid phone numbers to stdout.
2+ egrep ' ^[0-9]{3}-[0-9]{3}-[0-9]{4}$|^\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}$' file.txt
Original file line number Diff line number Diff line change 1+ # Read from the file file.txt and print its transposed content to stdout.
2+ wordcount=$( head -1 file.txt | wc -w)
3+ col_n=1
4+ while [[ $col_n -le $wordcount ]]; do
5+ awk " { print \$ $col_n }" file.txt | paste -sd " "
6+ col_n=$(( col_n + 1 ))
7+ done
You can’t perform that action at this time.
0 commit comments