# Read only first word of line from line with $fscanf()

**URL:** <https://verificationacademy.com/forums/t/read-only-first-word-of-line-from-line-with-fscanf/31324>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, fscanf\
**Created:** [December 17, 2015, 8:20am UTC](https://verificationacademy.com/forums/t/read-only-first-word-of-line-from-line-with-fscanf/31324 "2015-12-17T08:20:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Vaino](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/a4c791/32.png) [@Vaino](https://verificationacademy.com/forums/u/Vaino)\
**Post date:** [December 17, 2015, 12:31pm UTC](https://verificationacademy.com/forums/t/read-only-first-word-of-line-from-line-with-fscanf/31324/3 "2015-12-17T12:31:56Z")

</div>

_In reply to [ayehia](https://verificationacademy.com/forums/t/read-only-first-word-of-line-from-line-with-fscanf/31324/2):_

No,

%s is definitely NOT sufficient in my case.

I have text file including a random amount of columns up to ten pieces. Those columns are separated with white space characters (blanks or tabs). Inside my scoreboard, I am only interested about the first column (i.e. first word) of the line. Text file is for example as follows:

sss sss sss sss ssss

That’s why I wanna just use syntax I typed in my first post to this thread. I want also sideline $sscanf() function as it adds redundancy since $fgets() need to called before $sscanf() to get line as string input for the scan function. So, please give info if you know how **“%s%\*[^\n]”** syntax should be interpreted in SV. I think $fscanf() is imported mostly from C language’s fscanf, so why that syntax is tackled?

-Vaino

---

_[View the full topic](https://verificationacademy.com/forums/t/read-only-first-word-of-line-from-line-with-fscanf/31324)._
