How can I select the characters or file path after the Dev\” and dev\ from the column in a spark DF?
Sample rows of the pyspark column:
\\D\Dev\johnny\Desktop\TEST
\\D\Dev\matt\Desktop\TEST\NEW
\\D\Dev\matt\Desktop\TEST\OLD\TEST
\\E\dev\peter\Desktop\RUN\SUBFOLDER\New
Expected Output
johnny\Desktop\TEST
matt\Desktop\TEST\NEW
matt\Desktop\TEST\OLD\TEST
peter\Desktop\RUN\SUBFOLDER\New
I tried to use the code below.
df = df.withColumn(
"sub_path",
F.element_at(F.split(F.col("path"), "Dev\\\\"), -1)
)
It's only giving the part correct results that I want. Appreciate someone can help.