Sponsored Content
Top Forums Shell Programming and Scripting Adding a new column in a file with other existing columns Post 302455406 by Pratik4891 on Tuesday 21st of September 2010 01:45:03 PM
Old 09-21-2010
Hi Franklin ,

Here is the 1st column of input file

Code:
12344455
12
13
14
15
15
16
12344455

and the variable value i am externally passing say 14

and desired o/p should be

Code:
12344455
12                     13
13                     13
14                     13
15                     13
15                     13
16                     13
12344455

point is 13 should not be printed for 1st and last row
and sorry for the addressing Smilie

---------- Post updated at 12:45 PM ---------- Previous update was at 12:43 PM ----------

Hi ,

correction
variable value is 13

Last edited by Scott; 09-21-2010 at 04:14 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Adding header to an existing file

Dear All, I need to add a header of one line to an already existing file. I know that it can be achieved by the following: echo "Header" > newfile cat file1 >> newfile But my problem is that file is huge and there is no space for creating a new file every time. Is there a way that I can... (5 Replies)
Discussion started by: shash
5 Replies

2. Shell Programming and Scripting

Need Help for Adding Three new columns in existing file from fatching data from file

not required this time (36 Replies)
Discussion started by: Sandeep_Malik
36 Replies

3. Shell Programming and Scripting

how to add a new column in an existing file

Hi guys, Please help me if u have some solution. I have a file with three columns separated by ':' - INPUT_FILE C416722_2 : calin Dirigent : Dirigent AC4174_6 : Jac : cal_co TC4260_5 : [no : lin kite BC426302_1 : [no : calin Dirigent lin JC426540_3 : lin Pymo_bin : calin TC428_3 : no7... (4 Replies)
Discussion started by: sam_2921
4 Replies

4. Shell Programming and Scripting

Adding file to an existing tar

Hi Friends, I want to know the command to add a new file in a existing tar file. For Ex: I have a tar file file1.tar with the contents one.txt two.txt three.txt Now I need to add file four.txt to this existing tar file, how can I do it? Thanks in advance (4 Replies)
Discussion started by: mr_manii
4 Replies

5. Shell Programming and Scripting

Adding existing set of records in the same file

I have a file with 50,000 records in it, i have a requirement to use the same 50,000 records and add them 4 times to the same file to make a total of 200,000 records. I was wondering how to do this using ksh. Any help is greatly appreciated. (2 Replies)
Discussion started by: vpv0002
2 Replies

6. Shell Programming and Scripting

Awk to add columns from a file into an existing file

Hi! I would need some help to add the last two columns of one file into another file using awk (or something similar). For example, I have: file 1: file 2: car book day root lag bar look pay boot tag tar took may moot sag I want to have:... (5 Replies)
Discussion started by: coconaza
5 Replies

7. Shell Programming and Scripting

Adding a new column to an existing one

I have a data file that looks like this: 0.01 1 3822 4.97379915032e-14 4.96982253992e-09 0 0.01 3822 1 4.97379915032e-14 4.96982253992e-09 0 0.01 2 502 0.00993165137406 993.165137406 0 0.01 502 2 0.00993165137406 993.165137406 0 0.01 4 33 0.00189645523539 189.645523539 0 0.01 33 4... (3 Replies)
Discussion started by: kayak
3 Replies

8. Shell Programming and Scripting

Adding columns with values dependent on existing columns

Hello I have a file as below chr1 start ref alt code1 code2 chr1 18884 C CAAAA 2 0 chr1 135419 TATACA T 2 0 chr1 332045 T TTG 0 2 chr1 453838 T TAC 2 0 chr1 567652 T TG 1 0 chr1 602541 ... (2 Replies)
Discussion started by: plumb_r
2 Replies

9. UNIX for Dummies Questions & Answers

Solaris - Filter columns in text file and adding new column

Hello, I am very now to this, hope you can help, I am looking into editing a file in Solaris, with dinamic collums (lenght varies) and I need 2 things to be made, the fist is to filter the first column and third column from the file bellow file.txt, and create a new file with the 2 filtered... (8 Replies)
Discussion started by: jpbastos
8 Replies

10. Shell Programming and Scripting

Matching column then append to existing File as new column

Good evening I have the below requirements, as I am not an experts in Linux/Unix and am looking for your ideas how I can do this. I have file called file1 and file2. I need to get the second column which is text1_random_alphabets and find that in file 2, if it's exists then print the 3rd... (4 Replies)
Discussion started by: mychbears
4 Replies
tabs(1) 						      General Commands Manual							   tabs(1)

NAME
tabs - set tabs on a terminal SYNOPSIS
[tabspec] n] type] DESCRIPTION
sets the tab stops on the user's terminal according to the tab specification tabspec, after clearing any previous settings. The user's terminal must have remotely-settable hardware tabs. If you are using a non-HP terminal, you should keep in mind that behavior will vary for some tab settings. Four types of tab specification are accepted for tabspec: ``canned'', repetitive, arbitrary, and file. If no is given, the default value is i.e., UNIX ``standard'' tabs. The lowest column number is 1. Note that for tabs, column 1 always refers to the left-most column on a terminal, even one whose column markers begin at 0. Gives the name of one of a set of ``canned'' tabs. Recognized codes and their meanings are as follows: 1,10,16,36,72 Assembler, IBM S/370, first format 1,10,16,40,72 Assembler, IBM S/370, second format 1,8,12,16,20,55 COBOL, normal format 1,6,10,14,49 COBOL compact format (columns 1-6 omitted). Using this code, the first typed character corresponds to card column 7, one space gets you to column 8, and a tab reaches column 12. Files using this tab setup should have specify a format specification file as defined by below. The file should have the following format specification: 1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67 COBOL compact format (columns 1-6 omitted), with more tabs than This is the recommended format for COBOL. The appro- priate format specification is: 1,7,11,15,19,23 FORTRAN 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 PL/I 1,10,55 SNOBOL 1,12,20,44 UNIVAC 1100 Assembler In addition to these ``canned'' formats, three other types exist: A repetitive specification requests tabs at columns 1+n, 1+2xn, etc. Of particular importance is the value this represents the UNIX ``standard'' tab setting, and is the most likely tab setting to be found at a terminal. Another special case is the value implying no tabs at all. The arbitrary format permits the user to type any chosen set of numbers, separated by commas, in ascending order. Up to 40 numbers are allowed. If any number (except the first one) is preceded by a plus sign, it is taken as an increment to be added to the previous value. Thus, the tab lists 1,10,20,30 and 1,10,+10,+10 are considered identical. If the name of a file is given, reads the first line of the file, searching for a format specification. If it finds one there, it sets the tab stops according to it, otherwise it sets them as This type of specification can be used to ensure that a tabbed file is printed with correct tab settings, and is suitable for use with the command (see pr(1)): Any of the following can be used also; if a given option occurs more than once, the last value given takes effect: usually needs to know the type of terminal in order to set tabs and always needs to know the type to set margins. type is a name listed in term(5). If no option is supplied, searches for the value in the environment (see environ(5)). If is not defined in the environment, tries a sequence that will work for many terminals. The margin argument can be used for some terminals. It causes all tabs to be moved over n columns by making column n+1 the left margin. If is given without a value of n, the value assumed is 10. The normal (left-most) margin on most terminals is obtained by The margin for most terminals is reset only when the option is given explicitly. Tab and margin setting is performed via the standard output. EXTERNAL INFLUENCES
Environment Variables determines the interpretation of text within file as single- and/or multi-byte characters. determines the language in which messages are displayed. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. DIAGNOSTICS
Arbitrary tabs are ordered incorrectly. A zero or missing increment found in an arbitrary specification. A ``canned'' code cannot be found. option was used and file cannot be opened. option was used and the specification in that file points to yet another file. Indirection of this form is not permitted. WARNINGS
There is no consistency among different terminals regarding ways of clearing tabs and setting the left margin. It is generally impossible to usefully change the left margin without also setting tabs. clears only 20 tabs (on terminals requiring a long sequence), but is willing to set 64. SEE ALSO
nroff(1), pr(1), tset(1), environ(5), term(5). STANDARDS CONFORMANCE
tabs(1)
All times are GMT -4. The time now is 01:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy