You can use cut command to split a string after a specific character in bash shell
1 2 3 4 5 6 7 8 |
echo "debjeettoni@gmail.com" | cut -f1 -d"@" ## Returns debjeettoni echo "debjeettoni@gmail.com" | cut -f2 -d"@" ## Returns gmail.com echo "welcome to cloudaffaire" | cut -f1 -d"a" ## Returns welcome to cloud |