Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Regex to filter only IP's?

Posted on 2016-11-20
Last Modified: 2016-11-20
How to filter this IP only?     7 msmta9.newcombo.net     8 msmta18.newcombo.net     8 msjohn123  rapasins

Question by:john lambert
LVL 50

Expert Comment

ID: 41895051

pls try

Open in new window

LVL 27

Expert Comment

ID: 41895058
you don't need an ereg if you just want the first column

in shell scripting you can do this

while read ip junk ; do echo $ip ; done <INPUT_FILE >OUTPUT_FILE

what is tyour environment ? unix shell ? windows shell ? perl ? asp ?
LVL 34

Accepted Solution

Dan Craciun earned 500 total points
ID: 41895088
awk "BEGIN { FS=""" """ } { print $1 }" sterge.txt

Open in new window


Open in new window


Author Closing Comment

by:john lambert
ID: 41895090
thank you!!!ur the best!!

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can someone decipher this regex parameter? 6 44
SSRS - Suppress row when blank from 2nd dataset 2 64
Regex Replacement 9 63
Regex - Ignoring Spaces 7 35
I have been reconstructing a PHP-based application that has grown into a full blown interface system over the last ten years by a developer that has now gone into business for himself building websites. I am not incredibly fond of writing PHP code o…
Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question