Shell script example to Grep matching word from file

Hi expert, Need help in shell script.

a.txt file output is below

i would like to grep 3 line and 1st column value which is admin\22226 only and not full line. i only know admin word as 22226 can come anything with admin\ in file.

also after fetching it i would like to use this value with utility like rm admin\22226

whats the best way we can do it in one line if possible.

a.txt

--------

admin\22224       This is my file

admin\22225.1     This is my file2

admin\22226       This is my file3

----------

appreciate any help on this.

Welcome to the forum.

Please become accustomed to provide decent context info of your problem.

It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, directory structures, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two including your own attempts at a solution, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.

Try

grep -o "^admin[^ .]*" file
admin\22224
admin\22225
 admin\22226

For further processing you could redirect / pipe the result into another file / command.