11-04-2002
try sed with "tagged regular expressions", like this...
sed -e 's/^\(..............\).\(.*\)$/\1\|\2/g' yourfile > newfile
I just tagged the first 14 columns using
^\(..............\)
and from 16th column to last using
\(.*\)$
in between these two I left a single character belonging to the 15th column untagged...
in the replacement string, I reproduced the two tagged portions with a pipe in the middle using...
\1\|\2
in the above code I was replacing the 15th column with a "|", if you want to insert a pipe in the 15th column...
sed -e 's/^\(...............\)\(.*\)$/\1\|\2/g' yourfile > newfile
Cheers!
Vishnu.
Last edited by Vishnu; 11-04-2002 at 05:40 PM..
This User Gave Thanks to Vishnu For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
help me,
is there any script i can use to insert a single character in every line of the whole file? (1 Reply)
Discussion started by: dakid
1 Replies
2. UNIX for Dummies Questions & Answers
Hello
I have a unix variable $HDR in a script, which contains header info, and I need to create it as a new line at the top of a data file which is the input $1 in the script.
Paul (4 Replies)
Discussion started by: paul1s
4 Replies
3. Shell Programming and Scripting
i have a file contains like this:
i want to create a script that will insert a comma "." after the 10th character so it would be look like this
thanks in advance (5 Replies)
Discussion started by: dakid
5 Replies
4. Shell Programming and Scripting
Hi,
I want to insert data into a table from a flat file, the file is having around 25 columns and some 10,000 records.
The columns values are seperated by a space.
Thanks (1 Reply)
Discussion started by: ss_ss
1 Replies
5. Programming
Could anyone help me with an efficient(and easy) way to insert data in a file directly(with out using temp file).
example
open the file1.txt
11112222
333333
44444444
and insert something say " 99999 " somewhere inside the file
as
11112222
333 99999 333
44444444 (2 Replies)
Discussion started by: johnbach
2 Replies
6. Shell Programming and Scripting
Hi,
Please help me on this.
I want to insert data from text file to excel using shell script
nawk -v r=4 -v c=4 -v val=$a -F, 'BEGIN{OFS=","}; NR != r; NR == r {$c = val; print}' "file.csv"
I used above one to insert $a value in 4th row, 4th column in an excel file.csv and it... (3 Replies)
Discussion started by: suman.frnz
3 Replies
7. Shell Programming and Scripting
Hi Experts,
I have a config file (file1) & a data file (file2) :
- The file1 I want to modify : to replace "2nd fields c7? & m7? from the data from file2,
-The below CPU line fields need to fill by file2's 1st colmns correspoding data.
- The below MEM lines to be replaced by... (3 Replies)
Discussion started by: rveri
3 Replies
8. UNIX for Dummies Questions & Answers
Dear experts,
I am new to linux programming. I have a shell script which i should run it on all my samples.
I only define input and out put for this script. The inputs are 3 numbers(coordination numbers) which are available in a series of text file.
Since i have a lots of samples, it takes a... (5 Replies)
Discussion started by: mohamadreza
5 Replies
9. Shell Programming and Scripting
Hi,
I am trying to insert header row with a special character delimiter with Unicode u0109 into a file with ‘echo’, header looks like below
echo –e “header1\u0109header\u0109header3\u0109header4”
It just inserting as it is in the quotes but not the special character, Please suggest if am... (2 Replies)
Discussion started by: oom
2 Replies
10. Shell Programming and Scripting
For some testing I want to insert a non printable character in a file. How to do it? I inserted ctrl-v ctrl-k through vi. But I do not think it is a proper non printable character. (3 Replies)
Discussion started by: Soham
3 Replies
curs_insch(3X) curs_insch(3X)
NAME
insch, winsch, mvinsch, mvwinsch - insert a character before cursor in a curses window
SYNOPSIS
#include <curses.h>
int insch(chtype ch);
int winsch(WINDOW *win, chtype ch);
int mvinsch(int y, int x, chtype ch);
int mvwinsch(WINDOW *win, int y, int x, chtype ch);
DESCRIPTION
These routines insert the character ch before the character under the cursor. All characters to the right of the cursor are moved one
space to the right, with the possibility of the rightmost character on the line being lost. The insertion operation does not change the
cursor position.
RETURN VALUE
All routines that return an integer return ERR upon failure and OK (SVr4 specifies only "an integer value other than ERR") upon successful
completion, unless otherwise noted in the preceding routine descriptions.
NOTES
These routines do not necessarily imply use of a hardware insert character feature.
Note that insch, mvinsch, and mvwinsch may be macros.
PORTABILITY
These functions are described in the XSI Curses standard, Issue 4.
SEE ALSO
curses(3X).
Comparable functions in the wide-character (ncursesw) library are described in curs_ins_wch(3X).
curs_insch(3X)