Shell script help [was Tanmoy]

Hi,

You can use :

echo "GMDCOM.27936 [Tue Oct  1 13:32:40 2013]: Process Request <36812974>"|cut -d" " -f2-

OR

echo "GMDCOM.27936 [Tue Oct  1 13:32:40 2013]: Process Request <36812974>"|sed 's/.*\(\[Tue*\)/\1/'

Thanks

---------- Post updated at 06:47 PM ---------- Previous update was at 06:34 PM ----------

you can also use :

cat Gen.txt |awk '{$1="";print}'

Thanks
YB :slight_smile:

Please help me in understanding the below code.

awk '/Process Request/{$1="";print}' file

Hello,

Here is the explaination. We are searching for string "Process request" then we are making it's 1st field to null and printing the rest of the fields. As your input doesn't have "Process request" in 1st 3 lines so it will not look for those and all other lines it will remove the String "GMDCOM.27936 " too.

Thanks,
R. Singh

Hi,

In the command :

awk '/Process Request/{$1="";print}' file

awk is searhing for pattern "Process Request". When RE matched then it initializing $1 (first column) with BLANK ("")

at last printing the value of $0 (ROW).

Thanks

YB :slight_smile:

The content of the next post was moved to a new thread