Hi ,
I need to extract data from below mentioned data, having no delimiter and havin no fixed column length.
For example:
Member nbr Ref no date
10000 1000 10202012
200000 2000 11202012
Output:
to update DB with memeber nbr on basis of ref no.
I tried to count the number of character between Member ..... Ref
but not able to get into result .. anyone can help on same
I don't understand. What is the exact output you're looking for?
echo "0000 1000 10202012" | awk '{print $1}'
What's wrong with awk '{print $1","$2}' data_file
i have three columns in below format which contain space and similarly i have ulitple spaces between these column where evr i tried to extract 1 st column
with below command:
awk '{print $1}' it not working because i have space in coulmn name
- Member nbr
- Ref no
- date
i need to extract refno in such a way i will parse from starting with 'R ... to 'd' and count the no. of charcter and on baisi of that count i will extract ref no.
Your problem is that the first line (column titles) contains spaces in column names?
If you need to treat the headers separately I suggest s substitution of /\s+(no|nbr)/_$1/
on reading the first line.
I tried substitution command but it is not working
> echo "Member Nbr" | sed 's/\s+(no|nbr)/_$1/'
> Member Nbr
---------- Post updated at 07:21 AM ---------- Previous update was at 06:49 AM ----------
is it possible to read number of character between two words
Member Nbr Ref
Number of character between M and R is 10.
Sorry, you'd need to modify that search so that it was case insesnitive