Hello all
I have a data base of information that is formatted like so:
JSD4863 XXX-XX-XXXX DOE, JOHN C JR-II BISS CPSC BS INFO TECH 412/779-9445
I need the last four digits of the phone number. However, many lines contain
'garbage data' that I'm not interested in. So i used a 'for loop' to specify
which lines i wanted. The code looks like this:
This gives me the 11 lines that I want. However, it gives me the full phone
number. I want to ALSO pipe this command to only give me the last 4 digits.
I am not sure how to do this since the fields are delimited by two different
characters. I tried a couple variations of cut, but nothing work.
Please help
Last edited by vgersh99; 02-17-2013 at 05:49 PM..
Reason: corrected code tags
It reads the entire file, one line at a time, into the variables listed. It uses IFS to change the shell's default delimiters. It will split on all characters listed in IFS.
Running the code would also give you a better idea what it does.
Running cut to edit individual lines is like making 300 phone calls to say one word apiece. Best to break that habit as early as possible.
If all you want is the last four digits of the phone numbers on lines 11 through 22 of your data file and the phone number is the last field on those 12 lines, a couple of simple ways to do that are:
Hi.
I want to search 10 phone numbers automatically in Facebook and store the result in some format.
Can anyone help me with the script.
I am using kali Linux. (2 Replies)
What to know the way to count the number of delimiters in each record by ignoring the escape delimiters.
Sample Data:
12345678|ABN\|XYZ MED CHEM PTY. LTD.|C||100.00|22|AB"C\|Corp|"XYZ|CDEF"|
I'm using awk -F'|' '{ print NF-1 }' command to find the number of delimiters. this command... (8 Replies)
Hi Folks,
This is the first time I ever encountered this situation
My input file is of this kind
cat input.txt
1 PAIXAF 0 1 1 -9 0 0 0 1 2 0 2 1 2 1
7 PAIXEM 0 7 1 -9 1 0 2 0 1 2 2 1 0 2
9 PAKZXY 0 2 1 -9 2 0 1 1 1 0 1 2 0 1
Till the sixth column (which is -9), I want my columns to... (4 Replies)
Hi Everyone,
I have a flatfile "inbox.txt" which contains some information:
Location 0, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number : "+24800000023"
Sent : Sat 04 Aug 2012 09:01:00 PM +0700
Coding : Default GSM alphabet... (5 Replies)
Hi,
I have a problem to concatenate the lines based on number of delimiters (if the delimiter count is 9 then concatenate all the fields & remove the new line char bw delimiters and then write the following data into second line) in a file.
my input file content is
Title| ID| Owner|... (4 Replies)
Hello
If you wanted to sort a .csv file that was filled with lines like this:
<Ticker>,<Date as YYYYMMDD>,<Time as H:M:S>,<Volume>,<Corr>
(H : , M, S: )
by date, does anybody know of a better solution than to turn the 3rd and 4th colons of every line into commas, sorting on four keys,... (20 Replies)
I have the following string sample:
bla bla bla bla bla
I would like to extract the "123" using awk.
I thought about awk -F"]" '{ print $1 }' but it doesn't work
Any ideas ? (7 Replies)
Hi All,
I am doing a perl script validation for Phone numbers.
The normal phone number format is 01-32145.
I need to do two validations for the phone number
1) A valid phone number can have at least two digits as prefix and at least five digits as postfix. e.g. 01-01011
2) A... (5 Replies)
Hi,
I need to find the number of tab delimiters in the first line of a file.So using
word=`head -1 files.txt`
I have extracted the first line of file into a variable word.It has 20 tab delimted columns.So can anyone help me in finding the number of delimiters?
I am using csh and I am a... (5 Replies)
I have a list of files with names as "FULL_abcd_xyz_timestamp.txt" and "FULL_xx_abcd_xyz_timestamp.txt". I am writing a script with a 'for loop' to take each file, strip the "FULL" and "timestamp" from the file name and do some actions on the contains of the file. So I need to know the number of... (4 Replies)