> For the complete documentation index, see [llms.txt](https://code-snippets.hbamithkumara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-snippets.hbamithkumara.com/leetcode/problems/101-200/tenth-line.md).

# 195. Tenth Line

### Description

&#x20;Given a text file `file.txt`, print just the 10th line of the file.

&#x20;**Note:**\
1\. If the file contains less than 10 lines, what should you output?\
2\. There's at least three different solutions. Try to explore all possibilities.

### Constraints

### Approach

### Links

* GeeksforGeeks
* [Leetcode](https://leetcode.com/problems/tenth-line/)
* ProgramCreek
* YouTube

### **Examples**

{% tabs %}
{% tab title="Example 1" %}
**Input:**

Assume that file.txt has the following content:

<div align="left"><img src="https://1091135627-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEmU-aGQcUvtjjAH8_3%2F-MJ2fI9xi5QdwjnNR-Hq%2F-MJ2g-nAY4jn3sOY2sv1%2Fimage.png?alt=media&amp;token=39d66b60-38d5-4ffa-87d5-b4d052df9112" alt=""></div>

**Output:**

Your script should output the tenth line, which is:

Line 10
{% endtab %}
{% endtabs %}

### **Solutions**

{% tabs %}
{% tab title="Solution 1" %}

```bash
# Read from the file file.txt and output the tenth line to stdout.

awk 'NR==10' file.txt
```

{% endtab %}
{% endtabs %}

### **Follow up**

*
