Hi folks,
have a look into the attachment, i am not familiar with unix, can you please help me in this regard.
thanks in advance,
regards,
Geeko
Hi folks,
have a look into the attachment, i am not familiar with unix, can you please help me in this regard.
thanks in advance,
regards,
Geeko
Suggest that you copy and paste content from the word document here (unless it's too big) or attach it as a pure textfile. People might hesitate to open a word-file they don't know anything about.
previous_word=
cat your_file |
while read word rest_of_line ; do
print_word=$word
if [ "$print_word" = "$previous_word" ]; then
print_word="\t"
fi
print "$print_word $rest_of_line"
previous_word=$word
done
while(<DATA>){
my @tmp = split(" ",$_,2);
if($.==1){
$key=$tmp[0];
print;
}
else{
if(/$key/i){
$tmp[0]=sprintf ' ' x length($tmp[0]);
print join " ",@tmp;
}
else{
$key=$tmp[0];
print;
}
}
}
__DATA__
Maharastra Mumbai worli
Maharastra Mumbai navy
maharastra Pune
Maharastra Nagpur
Karnataka Bangalore
Karnataka Mysore
Karnataka Mangalore
Punjab Amritsar
punjab Jalandar
Try following sed script:
#!/bin/sed -f
1h
1!{
x
G
s/\([[:alnum:]]\+\)\>.*\n\1\(.*\)/\t\2/i
s/.*\n//
}