generate a file from existing file based on some rule

Hi guys,
i have a file in below format.let me explain first what i am trying to do .
i am making a file from this file , will rearrange these columns, then i will run several command(start/stop mentioned in this file) on unix environment. my requirements :

  1. i have 27 servers , on each server 34 processes are running so 34*27 rows are present in this file . each line is having start command- 3rd column, stop command - 5th column . so now , i want for each server , merge these 27 rows in 1 row ; but i want all 27rows start/stop command in that single row , so that if a program reads this file for command , it gets all commands and fire it on server. i tried to put commands in single line seperated by semicolon ;, but then vi editor gave me error, that not more than 200 charaters can put in a single line .
    can someone sugest how to do that ? also ,logic to combine these 27 rows in 1 row, having all 3rd and 5th column in that row's 3rd and 5th column ?
    hope it's clear , otherwise pls reply back
    #COMMON_NAME # LOGICAL_NAME # ACTUAL_DAEMON_NAME # START_COMMAND # PARAMETERS # STOP_COMMAND # CPU # USER # IS_AUTO_LOAD_FLAG # MAX_LIMIT # FROM_TIME # UNTIL_TIME # CHECK_FOR_NEW # GROUP # RESTART_FLAG

I read your requirements three times and I am still confused.

Could you please display a sample of the input and based on this input, the desired output?

Thank you.

:slight_smile: sorry.
input file :-

# aaa # aaa # abab # mkdir # -p # exit # CPU # USER # FLAG # LIMIT # FROM # UNTIL # ll -lart # G1 # RESTART_FLAG 
# bbb # bbb # baba # cd # . # ll # CPU # USER # FLAG # LIMIT # FROM # UNTIL # cd # G2 # RESTART_FLAG

so on lots of line (27*34) - 27 server , for each server 34 rows

output :- i am concerned on 3rd and 5th columns values

# G # G # anything # mkdir;cd;3rd row cmd;34th row cmd # . # exit;ll;3rd row cmd...34th row cmd # CPU # USER # FLAG # LIMIT # FROM # UNTIL # cd # G2 # RESTART_FLAG

ultimately i want , if some programs read first line for 1st server - it must take data from 3rd column (it wil take as per it's logic, dont worry abt that) and fire on unix account. but again , i can't combine 34 rows start/stop command in 1 line , and it should work on unix env. but Vi is not accepting so many characters in one line.
i want to fire all 34 commands on unix env in one shot .i can run those commands parellely as well, but in that case , unix account cannot bear 34 commands on one server and so it doesn't work, it's accepting 10-11 commands only in parellel.

Now I am more confused and even have more questions.

Let's try the following:

Display a sample REAL input.

Display the equivalent desired output based on the REAL input.

No words this time.

INPUT file:

RB0112 # RB0112 # grep cmd1  # start1 #  # stop1 # xxx #  yyy # 0 # 1 # # # # RBP2 # no
XLAOLC2542 # XLAOLC2542 # grep cmd2 # start2 # # stop  # xxx # yyy # 0 # 1 # # # # XLA # yes
SED011 # SED011 # grep cmd3 # start3 # # stop3 # xxx # yyy # 0 # 1 # # # # SED # yes
RBF042 # RBF042 # grep cmd4 # start4 # # stop4 # xxx # yyy # 0 # 1 # # # # RBFOFFS # no

OUTPUT File:
i want to merge 4 and 6 columns respectively
(note in input file , columns , xxx and yyy are same)

RB # RB # Common_Name  # start1;start2;start3;start #  # stop1;stop2;stop3;stop4 # xxx #  yyy # 0 # 1 # # # # RBP1 # no

u can ignore rest of the columns, just merge columns 4 and 6 of some set of rows based on similar xxx and yyy columns .
here limitation is - start1,start2..... and stop1 , stop2.... have lots of characters and so if we combile all of them in a single line , VI doesn't allow .
unix env limitation , i already explained. i want all those (34 commands) fire on unix env in one shot. if i fire in parellel , one line each from input file, they r not working .if i seperate commands by semicolon ;i can fire all 34 commands in one shot , and they will execute

---------- Post updated at 03:49 PM ---------- Previous update was at 04:02 AM ----------

anyone ?