Sample Header Ad - 728x90

Mapfile not removing trailing newline

3 votes
3 answers
2431 views
Sample Data: Tab separated file (TSV)
a.1.58	fadado/CSV	https://github.com/fadado/CSV 
a.1.63	jehiah/json2csv	https://github.com/jehiah/json2csv 
a.1.80	stedolan/jq	https://github.com/stedolan/jq/issues/370 
Following selects one record using fzf, and stores 2nd and 3rd column to an array Link:
mapfile -d $'\t' -t Link < <(awk 'BEGIN{FS="\t"; OFS="\t"} {print $2,$3}' "${SessionP}" | fzf)
## Issue In the above command I have used -t option of mapfile, but echo "${Link}" prints a trailing new line! **Why is it not getting eliminated?** ## Reference - [mapfile Man Page - Linux - SS64.com](https://ss64.com/bash/mapfile.html)
Asked by Porcupine (2156 rep)
Jul 26, 2021, 04:35 AM
Last activity: May 30, 2025, 10:52 PM