Even if the line number is more than the present content it has to display the line numbers for empty lines and then print the user input in the specified line number with the content.
#!/bin/bash
#!/bin/bash
echo -en "Enter the line number:"
read -r line_no
echo -en "Enter the name of the city:"
read -r city_name
#awk -v city_name="$city_name" -v line_no="$line_no" -F, 'NR $line_no {print "$city_name"} 1' file2.txt
New contributor
StackExchange.ready(function(){$.get(“https://stackoverflow.com/posts/69686680/ivc/5f70”);});
|