Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

about how to write a shell script to read the text file and perform transform


  • Please log in to reply
1 reply to this topic

#1 tester111

tester111

  • Members
  • 2 posts
  • OFFLINE
  •  
  • Local time:12:05 PM

Posted 05 November 2017 - 08:48 AM

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name

 

data_file.txt

 

column_name    file_name

col1                      file1

col2                      file2

col3                      file1

col4                      file1

col5                      file2

 

now, i would like to output below result to a text file, which returns all the column name by file name as belows.

 

file_name     column_name

file1               col1,col3,col4

file2               col2,col5

 

 

how can i write a shell script to read the data_file.txt line by line and output the result as above by file name.



BC AdBot (Login to Remove)

 


m

#2 tester111

tester111
  • Topic Starter

  • Members
  • 2 posts
  • OFFLINE
  •  
  • Local time:12:05 PM

Posted 05 November 2017 - 10:59 AM

anyone knows~






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users