To read a file line by line the bufio package Scanner is used. Let the text file be named as sample.txt and the content inside the file is as follows:
GO Language is a statically compiled programming language, It is an open-source language. It was designed at Google by Rob Pike, Ken Thompson, and Robert Grieserner. It is also known as Golang. Go language is a general-purpose programming language mainly meant for building large scale complex software.
- How to read a file line by line using node.js ?
- How to Read and Write the Files in Golang?
- How to read and write JSON file using Node.js ?
- How to Create an Empty File in Golang?
- How to Rename and Move a File in Golang?
- How to Delete or Remove a File in Golang?
- Command Line Arguments in Golang
- How to get file input by selected file name without path using jQuery ?
- How to reset selected file with input tag file type in Angular 9?
- How to execute TypeScript file using command line?
- Dirty read in SQL
- How to read Competitive Programming Questions?
- How to read if a checkbox is checked in PHP?
- How to read any request header in PHP
- CSS | :read-only Selector
- CSS | :read-write Selector
- Console.Read() Method in C#
- How to read a Matrix from user in Java?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.