The Archives

  • 13.Jul.09
    OR in grep cmd | rafacas | (0)
    $ egrep "regexp1|regexp2" file1 file2 Search one or more files (file1 and file2 in our example) for lines that match any of several (two in our case) regular expressions: regexp1 OR regexp2. The '|' stands for the OR.
  • 22.Apr.09
    Need to know your public IP? network | rafacas | (0)
    Some times you may need to know your public IP address. With this simple command you can find it out: $ curl -s | egrep -o "[0-9.]+" There are some other sites where we can discover it like whatismyip or whatismyipaddress, but the user-agent needs to be spoofed beacuse they ban curl, so the solution is using the -A option: $ curl -A "Mozilla/4.0" -s With the above command you will get the entire page bypassing the ban. But as the HTML of this pages is more complex and we do not want to fool them spoofing the user agent, we prefer ...