I'm just starting in bash to make the legwork for an internship easier. So I'm not very good and sorry in advance if my initial attempt is so off the mark as to be not helpful. Please don't hesitate to ask for clarification.My input resembles:Set11234Set25678I would like my output to be:group1  1   5group1  2   6group2  3   7group2  4   8So I could doA=$(sed -n '2p' input)B=$(sed -n '7p' input)printf group1\t$A\t$B >> outputand repeat this 3 more times.The problem is that instead of 2 groups of 4 numbers each, I actually have 7 groups of 34 numbers each, so something like 200-300 total. That's why I'd like to make a script that will automate this task. For the first 17 numbers (group1), I had:#!/bin/bash###############################################################################group1for (( i=0; i<=16; i++ )) ;doA=$(echo scale=1;x=2+$i; x |bc -l)B=$(echo scale=1;x=128+$i; x |bc -l)C=$(sed -n $Ap input)D=$(sed -n $Bp input)printf group1\t$C\t$D\n >> outputdone   Of course it doesn't work at all, probably for many reasons. For one thing, I haven't actually been able to use sed to filter a specific line using a variable as the input for the line number.That's my current error, but I suspect there will be more beyond that. I'm more than open to other approaches.Is there an automated way to take two line numbers as input and arrange them in columns along a single line?Is there an automated way to make this single line begin with another column eg. group1/group1/group2/group2?Thank you for any advice.
A bash script for taking two lines in a text file and forming columns along one line
bash;shell script