I want to write a small script of parsing all the comments of the C file using shell script but I am not even getting the read o/p correct,I am getting the file o/p mixed with other garbage data.
>/.1432804547.3007 /.1432804567.3007 /.1432804587.3007 /.1432804608.4021 /.1432804628.4021 /.1432804648.4021 /.1432804668.4021 /.1432804688.4021 /bin >/boot /dev /etc /home /lib /lib64 /lost+found /media /misc /mnt /net /opt /proc >/root /sbin /selinux /srv /sys /tmp /usr /var
>parsed_comments.tmp parse_func.sh file_update_time - update mtime and ctime time
>parsed_comments.tmp parse_func.sh @file: file accessed
>parsed_comments.tmp parse_func.sh
>parsed_comments.tmp parse_func.sh Update the mtime and ctime members of an inode and mark the inode
>parsed_comments.tmp parse_func.sh for writeback. Note that this function is meant exclusively for
>parsed_comments.tmp parse_func.sh usage in the file write path of filesystems, and filesystems may
>parsed_comments.tmp parse_func.sh choose to explicitly ignore update via this function with the
>parsed_comments.tmp parse_func.sh S_NOCMTIME inode flag, e.g. for network filesystem where these
>parsed_comments.tmp parse_func.sh timestamps are handled by the server.
>*/
>void file_update_time(struct file *file)
Here is what I am doing..
parse_comments() {
local filename="$1"
while read line; do
echo $line | grep "*"
done < "$filename"
parse_comments "/root/rpmbuild/linux-2.6.32-431.17.1.el6.x86_64/fs/inode.c"
I have tried all the solutions(like- while read -r, while read -u 3 and other too) told on SO for while read problem none of the solution worked for me.
I don't know whats wrong with read with while loop please help...
If I use 'awk' for the same work it works fine. But 'awk' doesn't serve my purpose.
No comments:
Post a Comment