ファイル名とその変更日を HDFS に出力しようとしています。hdfs の問題は、ls -l コマンドをサポートしていないため、
hdfs dfs -ls /directory_path
ここで使用した場合の出力例です。
Found 6 items
drwxr-xr-x - dps12 supergroup 0 2013-08-14 05:10 /data/PSG/LZ/FORECAST/201
drwxr-xr-x - dps12 supergroup 0 2013-08-15 05:13 /data/PSG/LZ/FORECAST/201
drwxr-xr-x - dps12 supergroup 0 2013-08-16 05:15 /data/PSG/LZ/FORECAST/203
drwxr-xr-x - dps12 supergroup 0 2013-07-30 20:32 /data/PSG/LZ/FORECAST/204
drwxr-xr-x - dps12 supergroup 0 2013-07-31 22:54 /data/PSG/LZ/FORECAST/205
drwxr-xr-x - dps12 supergroup 0 2013-08-13 04:15 /data/PSG/LZ/FORECAST/206
私が必要とする出力は
2013-08-14 /data/PSG/LZ/FORECAST/201
2013-08-15 /data/PSG/LZ/FORECAST/201
2013-08-16 /data/PSG/LZ/FORECAST/203
2013-07-30 /data/PSG/LZ/FORECAST/204
2013-07-31 /data/PSG/LZ/FORECAST/205
2013-08-13 /data/PSG/LZ/FORECAST/206
私は専門家にとって、これは非常に簡単であるに違いないことを知っています.
私は使用することを考えました
hdfs dfs -ls /directory_path | while read line ; do $line|awk 'print $4 $6' ; done;
でも何の役にも立たなかった