Thread: Script to replace characters in text file
i have odd request, lets have text file this:
i want script replace of hash tabs random characters.code:__##___##___iiiiii __##___##_____ii__ __##___##_____ii__ __#######_____ii__ __##___##_____ii__ __##___##_____ii__ __##___##___iiiiii
found command generate random character
so guess need know how script search , replace using random character upon each successive find until end of file occurs. can me this?apg -a1 -n1 -m1 -x1 -d
this kinda works
resulted in this... wanted.#!/bin/bash
j in {1..31}
do
char=`apg -a1 -n1 -m1 -x1 -d`
echo $char
sed -i '0,/#/s/#/'$char'/' test.txt
done
__qj___h;___iiiiii
__o1___=<_____ii__
__vs___y:_____ii__
__,=vr~?8_____ii__
__+~___>8_____ii__
__y*___+}_____ii__
__tu___3#___iiiiii
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help Script to replace characters in text file
Ubuntu
Comments
Post a Comment