Monday, 16 October 2017

Anonymize or Replace text within a File using SED | Linux

Stream Editor aka 'sed' is a *nix utility to transform and parse text.

for example.
if a file testing.txt contains some text like ' helloworld.zip ',  it will be replace with any text or we can use $RANDOM function also.
sed s/hello.*zip/"hello://$RANDOM.zip"/g testing.txt
the final result will be like this:
hello12345.zip (any random number)
/g means all occurrence of this text


No comments:

Post a Comment