SSH - 使用grep和特殊字符

时间:2015-07-03 23:33:26

标签: ssh grep escaping

我试图在某些文件上搜索一些字符串,但我没有找到好的组合。

我想使用此命令,但我的语法错误

grep  -r -H "<?php $GLOBALS[" /var/www/vhosts/

我想搜索(通过SSH)/ var / www / vhosts

下文件的字符串<?php $GLOBALS[

1 个答案:

答案 0 :(得分:1)

使用此:

    static void Main(string[] args)
    {
        int dec;
        string hex;
        int decValue;
        string hexReversed;
        string hexValues = "0123456789ABCDEF";

        do
        {
            Console.Write("[Press 0 to Stop] Hexadecimal Value: ");
            hex = Console.ReadLine().ToUpper().Trim();

            if (hex != "0")
            {
                dec = 0;
                hexReversed = new String(hex.Reverse().ToArray());
                for (int i = 0; i < hexReversed.Length; i++)
                {
                    decValue = hexValues.IndexOf(hexReversed.Substring(i, 1));
                    if (decValue != -1)
                    {
                        dec = dec + (decValue * (int)Math.Pow(16, i));
                    }
                    else
                    {
                        Console.WriteLine("Invalid Hexadecimal Value!");
                        break;
                    }
                }
                if (dec != 0)
                {
                    Console.WriteLine(String.Format("{0} hex = {1} dec", hex, dec.ToString()));
                }
            }
        } while (hex != "0");
    }