Sponsored Content
Top Forums Shell Programming and Scripting Insert data in first column(if blank) from previous line first column Post 302904492 by jaydeep_sadaria on Wednesday 4th of June 2014 10:04:40 AM
Old 06-04-2014
Insert data in first column(if blank) from previous line fisrt column

Its working with nawk.
Thanks.

Regards
Jaydeep

---------- Post updated at 07:34 PM ---------- Previous update was at 07:17 PM ----------

Hi

I had one more same file in which I need to insert same in multiple line. Can u plz suggest me for same? ip/op is mention below.

INPUT:

Code:
SDIP     SNT          MS    CLREF  HP     LP       K  L  M  DIP
12ETM2   ETM2-12      MS-0         VC4-0  VC12-0   1  1  1  669RBL2
                        MS-1                VC12-1   2  1  1  670RBL2
                                          VC12-2   3  1  1  671RBL2
                                          VC12-3   1  2  1  672RBL2
                                          VC12-4   2  2  1  673RBL2

SDIP     SDIPOWNER
12ETM2   SDIPM2                                                  

SDIP     SNT          MS    CLREF  HP     LP       K  L  M  DIP
13ETM2   ETM2-12      MS-0         VC4-0  VC12-0   1  1  1  69RBL2
                      MS-1                VC12-1   2  1  1  60RBL2
                                          VC12-2   3  1  1  61RBL2
                                          VC12-3   1  2  1  62RBL2
                                          VC12-4   2  2  1  63RBL2

SDIP     SDIPOWNER
13ETM2   SDIPM2



OUTPUT:

Code:
SDIP     SNT          MS    CLREF  HP     LP       K  L  M  DIP
12ETM2   ETM2-12      MS-0         VC4-0  VC12-0   1  1  1  669RBL2
12ETM2                MS-1                VC12-1   2  1  1  670RBL2
12ETM2                                    VC12-2   3  1  1  671RBL2
12ETM2                                    VC12-3   1  2  1  672RBL2
12ETM2                                    VC12-4   2  2  1  673RBL2

SDIP     SDIPOWNER
12ETM2   SDIPM2                                                  

SDIP     SNT          MS    CLREF  HP     LP       K  L  M  DIP
13ETM2   ETM2-12      MS-0         VC4-0  VC12-0   1  1  1  69RBL2
13ETM2                MS-1                VC12-1   2  1  1  60RBL2
13ETM2                                    VC12-2   3  1  1  61RBL2
13ETM2                                    VC12-3   1  2  1  62RBL2
13ETM2                                    VC12-4   2  2  1  63RBL2

SDIP     SDIPOWNER
13ETM2   SDIPM2

Regards
Jaydeep Sadaria
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert first line of a file to first column of remaining files

I want to extraxt data from a html table the html file is downloaded from UG / PG Univ - Exam.Results April/May 2008 After processing the html file using sed i got the output like this 11305106082,RANJANI R, CS1251,20,69,P CS1302,20,45,P EC1006,20,52,P EC1351,20,53,P... (5 Replies)
Discussion started by: a_artha
5 Replies

2. Shell Programming and Scripting

Insert new line based on numerical number of column

My input file: Class Number Position Range 1 Initial 50 1 Initial 50 2 Terminal 150 2 Terminal 20 2 Single 10 3 Single 20 4 Double 50 5 Initial 50 5 Initial 60 Class Number... (11 Replies)
Discussion started by: patrick87
11 Replies

3. Shell Programming and Scripting

Can sed be used to insert data at specific column?

I'm trying to use sed to insert data at a specific column, let's say my data looks like this: 0553 1828 0552 1829 0550 1829 0549 1830 0548 1831 what I want is this: timein 0553 timeout 1828 timein 0552 timeout 1829 timein 0550 timeout 1829 timein 0549 timeout 1830 timein 0548... (5 Replies)
Discussion started by: mswartz
5 Replies

4. Shell Programming and Scripting

Insert and shifting data at column

Hi all, i have data like this joe : 1 :a bob : 2 :b sue : 3 :c foo : 4 :d at column 2 i want to insert TOP to the top column and at column 3 i want to insert BOTTOM to the bottom column. and the result will... (12 Replies)
Discussion started by: psychop13
12 Replies

5. Shell Programming and Scripting

Read column values from previous and next line using awk

Hi, I have a csv file which contains data that looks something like this: Key1 Key2 Key3 New_Key1 New_Key2 New_Key3 102 30 0 - - - 102 40 1 30 40 50 102 50 2 40 50 ... (4 Replies)
Discussion started by: Nishi_Licious
4 Replies

6. Shell Programming and Scripting

Compare 2 files and match column data and align data from 3 column

Hello experts, Please help me in achieving this in an easier way possible. I have 2 csv files with following data: File1 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:36:09,JOB_5340 08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350 08/23/2012... (5 Replies)
Discussion started by: asnandhakumar
5 Replies

7. Shell Programming and Scripting

Add a character C in a column if that column is blank

I have some files that look as follows. I need to add a character 'C' in the fifth column if that column is blank. I prefer in-place editing. 1 1 B M 0 0 203 0, 0.0 0, 0.0 0, 0.0 0, 0.0 0.000 360.0 360.0 360.0 141.9 15.4 28.8 66.1 2 2 B A ... (21 Replies)
Discussion started by: thejitha
21 Replies

8. Shell Programming and Scripting

Fill data in column with previous value

Gents, Kindly help me. I have a file with empty values in selected column, I will like to fill the empty values with the previous value. Example Input file X 4959 30010 66727.00 20457.001 1 1441 66512.00 20234.00 20520.001 X 4959 30010 66727.00 20457.001 145 ... (7 Replies)
Discussion started by: jiam912
7 Replies

9. Shell Programming and Scripting

Split column when value in column is blank in any row

Hi Experts, In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data My issue is i am not able to get header for column from raw file into new file which... (1 Reply)
Discussion started by: as7951
1 Replies

10. UNIX for Beginners Questions & Answers

How to insert data into black column( Secound Column ) in excel (.XLSX) file using shell script?

Source Code of the original script is down below please run the script and try to solve this problem this is my data and I want it column wise 2019-03-20 13:00:00:000 2019-03-20 15:00:00:000 1 Operating System LAB 0 1 1 1 1 1 1 1 1 1 0 1 (5 Replies)
Discussion started by: Shubham1182
5 Replies
form_driver(3CURSES)					     Curses Library Functions					      form_driver(3CURSES)

NAME
form_driver - command processor for the forms subsystem SYNOPSIS
cc [ flag... ] file... -lform -lcurses [ library... ] #include <form.h> int form_driver(FORM *form, int c); DESCRIPTION
The form_driver() function is the workhorse of the forms subsystem; it checks to determine whether the character c is a forms request or data. If it is a request, the form driver executes the request and reports the result. If it is data (a printable ASCII character), it enters the data into the current position in the current field. If it is not recognized, the form driver assumes it is an application- defined command and returns E_UNKNOWN_COMMAND. Application defined commands should be defined relative to MAX_COMMAND, the maximum value of a request listed below. Form driver requests: REQ_NEXT_PAGE Move to the next page. REQ_PREV_PAGE Move to the previous page. REQ_FIRST_PAGE Move to the first page. REQ_LAST_PAGE Move to the last page. REQ_NEXT_FIELD Move to the next field. REQ_PREV_FIELD Move to the previous field. REQ_FIRST_FIELD Move to the first field. REQ_LAST_FIELD Move to the last field. REQ_SNEXT_FIELD Move to the sorted next field. REQ_SPREV_FIELD Move to the sorted prev field. REQ_SFIRST_FIELD Move to the sorted first field. REQ_SLAST_FIELD Move to the sorted last field. REQ_LEFT_FIELD Move left to field. REQ_RIGHT_FIELD Move right to field. REQ_UP_FIELD Move up to field. REQ_DOWN_FIELD Move down to field. REQ_NEXT_CHAR Move to the next character in the field. REQ_PREV_CHAR Move to the previous character in the field. REQ_NEXT_LINE Move to the next line in the field. REQ_PREV_LINE Move to the previous line in the field. REQ_NEXT_WORD Move to the next word in the field. REQ_PREV_WORD Move to the previous word in the field. REQ_BEG_FIELD Move to the first char in the field. REQ_END_FIELD Move after the last char in the field. REQ_BEG_LINE Move to the beginning of the line. REQ_END_LINE Move after the last char in the line. REQ_LEFT_CHAR Move left in the field. REQ_RIGHT_CHAR Move right in the field. REQ_UP_CHAR Move up in the field. REQ_DOWN_CHAR Move down in the field. REQ_NEW_LINE Insert/overlay a new line. REQ_INS_CHAR Insert the blank character at the cursor. REQ_INS_LINE Insert a blank line at the cursor. REQ_DEL_CHAR Delete the character at the cursor. REQ_DEL_PREV Delete the character before the cursor. REQ_DEL_LINE Delete the line at the cursor. REQ_DEL_WORD Delete the word at the cursor. REQ_CLR_EOL Clear to the end of the line. REQ_CLR_EOF Clear to the end of the field. REQ_CLR_FIELD Clear the entire field. REQ_OVL_MODE Enter overlay mode. REQ_INS_MODE Enter insert mode. REQ_SCR_FLINE Scroll the field forward a line. REQ_SCR_BLINE Scroll the field backward a line. REQ_SCR_FPAGE Scroll the field forward a page. REQ_SCR_BPAGE Scroll the field backward a page. REQ_SCR_FHPAGE Scroll the field forward half a page. REQ_SCR_BHPAGE Scroll the field backward half a page. REQ_SCR_FCHAR Horizontal scroll forward a character. REQ_SCR_BCHAR Horizontal scroll backward a character REQ_SCR_HFLINE Horizontal scroll forward a line. REQ_SCR_HBLINE Horizontal scroll backward a line. REQ_SCR_HFHALF Horizontal scroll forward half a line. REQ_SCR_HBHALF Horizontal scroll backward half a line. REQ_VALIDATION Validate field. REQ_PREV_CHOICE Display the previous field choice. REQ_NEXT_CHOICE Display the next field choice. RETURN VALUES
The form_driver() function returns one of the following: E_OK The function returned successfully. E_SYSTEM_ERROR System error. E_BAD_ARGUMENT An argument is incorrect. E_NOT_POSTED The form is not posted. E_INVALID_FIELD The field contents are invalid. E_BAD_STATE The routine was called from an initialization or termination function. E_REQUEST_DENIED The form driver request failed. E_UNKNOWN_COMMAND An unknown request was passed to the form driver. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), forms(3CURSES), attributes(5) NOTES
The header <form.h> automatically includes the headers <eti.h> and <curses.h>. SunOS 5.10 31 Dec 1996 form_driver(3CURSES)
All times are GMT -4. The time now is 02:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy