Wednesday 15 June 2011

ios - Sed Command in Xcode -



ios - Sed Command in Xcode -

hi need extract text variables out of text file right have text displaying in 1 chunk

jimenez ** 353743 valerie rose bed no. 121203 7/2 vale road mount colah acc .# k00525 aae79 2079 ph: (02) 9987-4333 pen: none dob: 19/02/1935

i able extract text single strings such phone number or dob.

nsstring* result = [[nsstring alloc] initwithdata:downloadeddata encoding:nsutf8stringencoding]; textview.text = result;

this code have , text getting downloaded server.

you utilize below grep command phone number , dob.

grep -op '(ph|dob):\s*\k.*?(?=\s+[a-z]|$)' file

or

you seek below sed command.

$ sed -n 's/.*\(ph: *.*\) pen:.*\(dob *[^ ]*\)/\1 \2/p' file ph: (02) 9987-4333 dob: 19/02/1935

ios xcode text sed extraction

No comments:

Post a Comment