BEGIN{
printf ("%s\t%s\t%s\t\n", "First Char", "Last Char", "Total Chars");
}
{
chars = split($1, line, //);
charline = line[chars];
firstchar = line[1];
lastchar = substr(charline,length(charline));
countchar = length(chars);
printf("%s\t\t%s\t\t%d\t\n", firstchar, lastchar , countchar);
}
END{
print"The total number of lines in synopsisFile = " NR;
}
File Used:
Here is the first line
The second line is fun
End
Need to print first and last character of each line and count of characters. Can display the first character, and maybe the last, not sure what the second line displays, it gives me and 'e', but thats not the last character? The count is wrong too, it gives one for everything. help please?!