apache pig - Date wise listing of hadoop file in pig -


i did :

hadoop dfs -ls /user/abc/fun/

and worked fine , listed files in increasing order alphabetically. want listing of files according date in increasing order i.e. latest date file placed @ bottom

something this:

hadoop dfs -ls ltrh /user/abc/fun/

it didn't worked read pig's wiki not valid fsshell command. please suggest how desired result. appreciated.thanks!!!

there couple of ways

  • if want inside pig shell , not script save following command hadoop fs -ls /user/abc/fun/ | sort -k6,7 inside test.sh file. give chmod +x permissions inside grunt shell can sh ./test.sh desired result.
  • suppose want include inside pig script , run using pig -f can use %declare basedir hadoop fs -ls /user/abc/fun/ | sort -k6,7 | tail -1

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -