Sponsored Content
Full Discussion: Add column to a file
Top Forums Shell Programming and Scripting Add column to a file Post 302562011 by Olivia on Wednesday 5th of October 2011 05:57:54 PM
Old 10-05-2011
Apologize, I was not clear

That's is input
my output should be

$File 1 name1
$File 2 name2
$File 3 name3
$File 4 name4


$File is the file name generated from the script.

---------- Post updated at 04:17 PM ---------- Previous update was at 04:10 PM ----------

Thank you both yeah, thats exactly what I am looking for Smilie i appreciate your help.

Quote:
Originally Posted by aster007
Code:
file=<filename with timestamp>

while read LINE
do 
    echo "$file $LINE" >> temp_file.txt
    
done < input_file 

temp_file.txt > input_file



As Corona688 has said, we will only get a better idea of what you want if you post more details.
This is what I roughly understood from your post.
---------- Post updated at 04:57 PM ---------- Previous update was at 04:17 PM ----------

Yeah it worked but is there any other way as because it's been adding first column to the blank rows too Smilie
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

How to add a particular column alone in a file

Hi I have file which contains 5 coulmns i need to add the fifth column value and put it in the desired location in the same column. Here is the sample file.. ashop0004 SQL- 06/14/2009 06/14/2009 00:04:28 SUM ashop0004 SQL- 06/14/2009 06/14/2009 00:00:37 ... (22 Replies)
Discussion started by: cutechaps
22 Replies

3. Shell Programming and Scripting

Need to add letters to a column and add in a new column subtracting from another column

So I have this input 1 10327 rs112750067 T C . PASS DP=65;AF=0.208;CB=BC,NCBI 1 10469 rs117577454 C G . PASS DP=2055;AF=0.020;CB=UM,BC,NCBI 1 10492 rs55998931 C T . PASS DP=231;AF=0.167;CB=BC,NCBI 1 10583 rs58108140 G A ... (3 Replies)
Discussion started by: kellywilliams
3 Replies

4. Shell Programming and Scripting

Add column info from one file to larger second file

Hi, long time reader, first time poster. I've done some searching so please if this is a repeated post excuse the duplicate, but what I have are two files roughly like so: File 1: A W B X C Y D Z File 2: A 1 C 2 D 3 And what I would like to get out is... (4 Replies)
Discussion started by: wallysb01
4 Replies

5. Shell Programming and Scripting

How to add a column from other file?

Dear all, Lets say, I've a file a.txt containing two columns, like a1 b1 .. .. .. .. and another file b.txt containg two columns, like a1 c1 .. .. .. .. I need to put c1 column from b.txt file to the a.txt file. So, the output should be a1 b1 c1 .. .. .. .. ... (4 Replies)
Discussion started by: mkg
4 Replies

6. Shell Programming and Scripting

Help with add existing file name as new data column in new output file

Input File 1 cat S1.txt MI0043 2731 miR-1 Input File 2 cat S4.txt MI006 310 CiR-1 MI057 10 CiR-24 MI750 5 CiR-24 Desired Output File 1 cat S1.txt.out MI0043 2731 miR-1 S1.txt Desired Output File 2 cat S4.txt.out MI006 310 CiR-1 S4.txt (3 Replies)
Discussion started by: perl_beginner
3 Replies

7. Shell Programming and Scripting

Add a new column to file

I have file like this b,c 10,20 30,40 50,60 Now I want to add a new column a with fixed values for all the rows a,b,c 60,10,20 60,30,40 60,50,60 Please let me know how can we do this in unix. (4 Replies)
Discussion started by: weknowd
4 Replies

8. UNIX for Dummies Questions & Answers

Add a column to a file

Hi, I have this data file that contains: 1 A 2 B 3 C 4 D 5 E 6 F 7 G 8 H 9 I I want the results to be: 1 A A 2 B A 3 C A 4 D A 5 E A 6 F A 7 G A 8 H A (8 Replies)
Discussion started by: bobo
8 Replies

9. Shell Programming and Scripting

Add new column in the file

Hi Team I have file as below empno,ename,sal 123,smith,1000 124,adams,2000 Required output: Using AWK empno,ename,sal,deptno 123,smith,1000 124,adams,2000 Thanks, Murali (5 Replies)
Discussion started by: bmk
5 Replies

10. UNIX for Beginners Questions & Answers

Add new column from another file

Hi, I have 2 files. file1 contains by lines: hash:salt:id file2 contains by lines: username:hash:salt I would like to add a new coloumn (id) form file1 to file2. The new file should contains: username:hash:salt:id Note: file1 contains less rows than file2. I tried paste -d':' file1... (12 Replies)
Discussion started by: freeroute
12 Replies
JED(1)								   User Manuals 							    JED(1)

NAME
Jed - programmers editor SYNOPSIS
jed --version jed-script --version xjed --version jed [--secure] [--batch|--script|--help] [options] file ... jed-script [--secure] script file [script options] ... xjed [--secure] [X options] [--batch|--script|--help] [options] file ... DESCRIPTION
Jed - programmers editor Features: Color syntax highlighting. Emulation of Emacs, EDT, Wordstar, and Brief editors. Extensible in a language resembling C. Completely cus- tomizable. Editing TeX files with AUC-TeX style editing (BiBTeX support too). Folding support, and much more... For complete documentation, see GNU info files, this manual only provides brief tutorial. OPTIONS
major options --version prints the version and compiletime variables. --help prints usage information. --secure runs Jed in secure mode, e.g. you can't run any external commands with system() or run_shell_cmd(). --batch run Jed in batch mode. This is a non-interactive mode. --script this is a mode like --batch but jed does not eval the startup files. It behaves like slsh. You must give the file that should be evaluated as second argument. It's the same as calling jed-script. minor options -n do not load .jedrc file. -a 'file' load file as user configuration file instead of .jedrc. + 'n' goto line n in buffer (notice that in order to this option to take effect, if must appear before the file name in the command line, like 'jed +3 file') -g 'n' goto line n in buffer (notice that in order to this option to take effect, if must appear after the file name in the command line, like 'jed file -g 3') -l 'file' load file as S-Lang code. -f 'function' execute S-Lang function named function -s 'string' search forward for string -2 split window -i 'file' insert file into current buffer. X options xjed accapts the common options like -display, -name, -fn and -geometry. Additionaly it accepts -facesize SIZE, -fs SIZE if build with XRENDERFONT support, selects the font size SIZE. Use it with the option -fn to select a scalable font. -foreground COLOR, -fg COLOR sets the foreground color. -background COLOR, -bg COLOR sets the background color. -fgMouse COLOR, -mfg COLOR sets the foreground color of the mouse pointer. -bgMouse COLOR, -mbg COLOR sets the background color of the mouse pointer. -Iconic, -ic start iconified. -title NAME sets the window title to NAME. For more options look at xterm.c. CONFIGURATION
Emulating Other Editors JED's ability to create new functions using the S-Lang programming language as well as allowing the user to choose key bindings, makes the emulation of other editors possible. Currently, JED provides reasonable emulation of the Emacs, EDT, and Wordstar editors. Emacs Emulation Emacs Emulation is provided by the S-Lang code in emacs.sl. The basic functionality of Emacs is emulated; most Emacs users should have no problem with JED. To enable Emacs emulation in JED, make sure that the line: () = evalfile ("emacs"); is in your jed.rc (.jedrc) startup file. JED is distributed with this line already present in the default jed.rc file. EDT Emulation For EDT emulation, edt.sl must be loaded. This is accomplished by ensuring that the line: () = evalfile ("edt"); is in present in the jed.rc (.jedrc) Startup File. Wordstar Emulation wordstar.sl contains the S-Lang code for JED's Wordstar emulation. Adding the line () = evalfile ("wordstar"); to your jed.rc (.jedrc) startup file will enable JED's Wordstar emulation. RUN TIME
Status line and Windows JED supports multiple windows. Each window may contain the same buffer or different buffers. A status line is displayed immediately below each window. The status line contains information such as the JED version number, the buffer name, mode, etc. Please beware of the fol- lowing indicators: ** buffer has been modified since last save. %% buffer is read only. m Mark set indicator. This means a region is being defined. d File changed on disk indicator. This indicates that the file associated with the buffer is newer than the buffer itself. s spot pushed indicator. + Undo is enabled for the buffer. [Narrow] Buffer is narrowed to a region of LINES. [Macro] A macro is being defined. Mini-Buffer. The Mini-Buffer consists of a single line located at the bottom of the screen. Much of the dialog between the user and JED takes place in this buffer. For example, when you search for a string, JED will prompt you for the string in the Mini-Buffer. The Mini-Buffer also provides a direct link to the S-Lang interpreter. To access the interpreter, press Ctrl-X Esc and the S-Lang> prompt will appear in the Mini-Buffer. Enter any valid S-Lang expression for evaluation by the interpreter. It is possible to recall data previously entered into the Mini-Buffer by using the up and down arrow keys. This makes it possible to use and edit previous expressions in a convenient and efficient manner. Basic Editing Editing with JED is pretty easy - most keys simply insert themselves. Movement around the buffer is usually done using the arrow keys or page up and page down keys. If edt.sl is loaded, the keypads on VTxxx terminals function as well. Here, only the highlights are touched upon (cut/paste operations are not considered `highlights'). In the following, any character prefixed by the ^ character denotes a Control character. On keyboards without an explicit Escape key, Ctrl-[ will most likely generate and Escape character. A prefix argument to a command may be generated by first hitting the Esc key, then entering the number followed by pressing the desired key. Normally, the prefix argument is used simply for repetition. For example, to move to the right 40 characters, one would press Esc 4 0 followed immediately by the right arrow key. This illustrates the use of the repeat argument for repetition. However, the prefix argu- ment may be used in other ways as well. For example, to begin defining a region, one would press the Ctrl-@ key. This sets the mark and begins highlighting. Pressing the Ctrl-@ key with a prefix argument will abort the act of defining the region and to pop the mark. The following list of useful keybindings assumes that emacs.sl has been loaded. Ctrl-L Redraw screen. Ctrl-_ Undo (Control-underscore, also Ctrl-X u'). Esc q Reformat paragraph (wrap mode). Used with a prefix argument. will justify the paragraph as well. Esc n narrow paragraph (wrap mode). Used with a prefix argument will justify the paragraph as well. Esc ; Make Language comment (Fortran and C) Esc Trim whitespace around point Esc ! Execute shell command Esc $ Ispell word Ctrl-X ? Show line/column information. ` quoted_insert --- insert next char as is (backquote key) Esc s Center line. Esc u Upcase word. Esc d Downcase word. Esc c Capitalize word. Esc x Get M-x minibuffer prompt with command completion Ctrl-X Ctrl-B pop up a list of buffers Ctrl-X Ctrl-C exit JED Ctrl-X 0 Delete Current Window Ctrl-X 1 One Window. Ctrl-X 2 Split Window. Ctrl-X o Other window. Ctrl-X b switch to buffer Ctrl-X k kill buffer Ctrl-X s save some buffers Ctrl-X Esc Get "S-Lang>" prompt for interface to the S-Lang interpreter. Esc . Find tag Ctrl-@ Set Mark (Begin defining a region). Used with a prefix argument aborts the act of defining the region and pops the Mark. FILES
JED_ROOT/lib/*.sl these are the default runtime jed slang files (packages like jed-extra can define additional slang library directories) JED_ROOT/lib/site.sl This is the default startup file. /etc/jed.d/*.sl The system wide configuration files (this is a special Debian feature). ~/.jedrc Per user configuration file, or ~/.jed/jed.rc per user configuration file if the Jed_Home_Directory ~/.jed/ exists. AUTHOR
John E. Davis <davis@space.mit.edu> Jed's Author --- This document was translated to nroff by "Boris D. Beletsky" <borik@isracom.co.il> Debian OCT 1996 JED(1)
All times are GMT -4. The time now is 06:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy