ARASH
ARASH

Reputation: 428

How to edit txt file inside the HDFS in terminal?

Is there any way to modify the txt file inside HDFS directly via terminal? Assume, I have "my_text_file.txt", and I would like to modify it inside HDFS using below command.

$ hdfs dfs -XXXX user/my_text_file.txt

I am interested to know "xxxx" if there exists any. Please note that I don't want to make modification in local and then copy it to HDFS.

Upvotes: 4

Views: 4737

Answers (3)

Md Firdaus Alam
Md Firdaus Alam

Reputation: 77

You can not edit files in HDFS, as it works on the principle of Write once, Read Many.But now a day, we can edit file using Hue file browser in cloudera.

Upvotes: 2

Ramesh Maharjan
Ramesh Maharjan

Reputation: 41987

Currently as explained by @BruceWayne, its not possible. It would be very difficult to edit the files stored in hdfs because all the files are distributed in hdfs and it would be very difficult to edit in the terminal using hdfs commands. Currently these are supported as terminal commands.

You can edit them by locating the data location of each datanode in the cluster.But that would be troublesome.

Moreover you can install HUE. With HUE you can edit the files in hdfs using web UI.

Upvotes: 2

BruceWayne
BruceWayne

Reputation: 3374

You cannot edit files, which all are already in HDFS. It will not support. HDFS works on "Write once, read many". So if you want to edit a file, make changes in your local copy then move it to HDFS.

Upvotes: 6

Related Questions