Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Channel Name Service Handle Package Name BSG Handle Package_tier
FX East 48129 47100 Premier (EB) 47100 4168
FX West 48130 47100 Premier (EB) 47100 4168
Resource Authorization in Effe 259 47100 Premier (EB) 47100 4168
This file is having 5 columns and the below once are values and i need to get output as
The columns names are
Channel Name ,Service Handle ,Package Name, BSG Handle,Package_tier
And others are all values.
output as:-
Channel Name : FX East ; Service Handle : 48129 ; Package Name : 47100 Premier (EB) ; BSG Handle : 47100 ; Package_tier : 4168
Channel Name : FX West ; Service Handle : 48130 ; Package Name : 47100 Premier (EB) ; BSG Handle : 47100 ; Package_tier : 4168
Can anyone please help me.
Hi,
whenever you post sample data or code you should use code-tags. The data you provided looks quite messy. Are the columns really separated by space or TAB? It is easy to achieve what you want if the data is TAB separated. Not so easy if it is in fact space separated. Please clarify on that and post some representative sample data.
awk -F"\t" 'NR > 1 {print "Channel Name :", $1, "; Service Handle :", $2, "; Package Name :", $3, "; BSG Handle :", $4, "; Package_tier :", $5}' file
Bash:
Code:
#!/bin/bash
IFS=$(echo -e "\t")
skip=1
while read a b c d e
do
if [[ $skip == 0 ]]
then
echo "Channel Name : $a ; Service Handle : $b ; Package Name : $c ; BSG Handle : $d ; Package_tier : $e"
fi
skip=0
done < file
Mah! I have seen many situations like this and still I cannot understand the reasons for such a rude behavior. If the OP returns it's ok, otherwise this thread is eligible for closure. Nuff' said.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.