Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Insert Commas at fixed positions Post 302390207 by jostber on Wednesday 27th of January 2010 07:45:07 AM
Old 01-27-2010
You can try this:

Code:
cat testfil2.txt | sed -e 's/Code[0-9]*/&,/g' | sed -e 's/Value[0-9]*/,&/g'


Last edited by Franklin52; 01-27-2010 at 08:46 AM.. Reason: Please use code tags!
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I insert commas/delimiters in File

Hi, Newbie here. Need to convert a txt file to .csv format. There's no character to replace so not sure if I can use sed :confused: . The comma is to be inserted after every certain number of characters in each line... Help! Thanks. (4 Replies)
Discussion started by: mbelen
4 Replies

2. Shell Programming and Scripting

How to insert a record in fixed width flatfile

I have a fixed width flatfile with 5 columns, i will load file from oracle database to the flatfile for every 15 min at the end of the file, i want to insert a record by calling a shell script for inserting a record. please can any one help me. Thanks. (1 Reply)
Discussion started by: limou
1 Replies

3. UNIX for Advanced & Expert Users

Insert Delimiter at fixed locations in a flat file

Hi Can somebody help me with solution for this PLEASE? I have a flat file and need to insert delimiters at fixed positions in all the lines so that I can easily convert into EXCEL with columns defined as per their width. For Example Here is the file { kkjhdhal sdfewss sdtereetyw... (7 Replies)
Discussion started by: jd_mca
7 Replies

4. Shell Programming and Scripting

awk script replace positions if certain positions equal prescribed value

I am attempting to replace positions 44-46 with YYY if positions 48-50 = XXX. awk -F "" '{if (substr($0,48,3)=="XXX") $44="YYY"}1' OFS="" $filename > $tempfile But this is not working, 44-46 is still spaces in my tempfile instead of YYY. Any suggestions would be greatly appreciated. (9 Replies)
Discussion started by: halplessProblem
9 Replies

5. Shell Programming and Scripting

Insert text with Sed (in various positions)

Hello. I'm trying to insert text in various positions and I could only do that using pipes for each position. Example: cat file | sed -e 's#\(.\{5\}\)\(.*\)#\1:\2#g' | sed -e 's#\(.\{26\}\)\(.*\)#\1:\2#g' Insert ":" at position 5 and 26. it can be done in the same sentence, without using... (4 Replies)
Discussion started by: </kida>
4 Replies

6. Shell Programming and Scripting

Insert Inverted Commas Around Numeric Values

Hi, I am trying to insert Inverted Commas around all the numeric values within a comma seperated string / variable. 1111,2222,3333,4444 I would like it to be: '1111','2222','3333','4444' Note - This string could have a differing amount of numeric values each time the variable is... (4 Replies)
Discussion started by: RichZR
4 Replies

7. UNIX for Dummies Questions & Answers

Insert single quote and commas

Hi All, I have a set of data as below : XS012371378 Raj 23-09-12 SH128238948 Andrew 24-08-12 CH273712399 Walsh 12-10-12 JK7249923893 Nick 10-02-13 JP6383791389 Braslin 30-12-13 I want the first column to be extracted separately. I can get this using awk. awk '{print $1}' file_name ... (3 Replies)
Discussion started by: Nand Kishor
3 Replies

8. Shell Programming and Scripting

Replace characters at fixed positions

My objective is to replace the 8th, 9th, 10th characters by 1 space per character (total 3 spaces) in a file. I achieved this using following command: sed 's/\(.\)/\1@/7;s/@\(...\)/ /' FileData.txt > FileData_UPDATED.txt Another situation comes when I need to done same but excluding 1st... (5 Replies)
Discussion started by: manishdivs
5 Replies

9. UNIX for Beginners Questions & Answers

Insert commas

Original content: ACACCTCAT 129 | ACACCTCAT 0 ACACCTCATX 171 | ACACCTCATX 0 ACACRESRT 0 ACACRESRT 0 ACACRESRTX 0 ... (4 Replies)
Discussion started by: loktamann
4 Replies
MPM(6)								   Games Manual 							    MPM(6)

NAME
mpm, mspe - macros for page makeup SYNOPSIS
troff -mpm file ... troff -mspe file ... DESCRIPTION
These troff(1) macros, largely compatible with ms(6), make better pages. They silently invoke and provide information to a postprocessor that moves floating figures, avoids widows, and justifies pages vertically by stretching vertical spaces that result from .PP, .LP, .IP, .QP, .SH, .NH, .DS/.DE, .EQ/.EN, .TS/.TE, .PS/.PE, .P1/.P2, and .QS/.QE. The packages support different styles: -mpm generic -mspe Software--Practice and Experience The following macros are different from or not part of -ms. Values denoted n have default value 1v. .BP Begin a new page. .FL Flush: force out previous keeps. .FC Finish a two-column region and start a new one. .KF m Floating keep, with preferred center at vertical position m. Special values (default) and are permitted. .NE n Start new page if remaining vertical space on this page is less than n. .P1 Begin a program display (constant width font). .P2 End a program display. .P3 Insert optional break point in program display. .SP n exactly .SP n Insert vertical space of height n, stretchable unless exactly is present. .Tm text Place page number and text on the standard error output. .X text Present text to the hidden page-makeup program as part of a device-dependent output sequence x X text. Equivalent to X'text'. Useful number registers: HM Header margin; default 1 inch. FM Footer margin; default 1 inch. FO Footer position; default 10 inches. %# Page number of current page. dP,dV Shrinkage of point size and vertical spacing for .P1, in points. Useful strings: %e,%o Even and odd page title commands, as .tl ''''. FILES
/sys/lib/tmac/tmac.pm /$cputype/bin/aux/pm SOURCE
/sys/src/cmd/pm SEE ALSO
ms(6), troff(1) B. W. Kernighan and C. J. Van Wyk, ``The -mpm Macro Package'', Unix Research System Programmer's Manual, Tenth Edition, Volume 2. BUGS
These features of -ms are missing: Document styles other than the default .RP. Space between front matter and first paragraph. Recover it with .SP 2. Separating rule above footnotes. Keeps assigned to a separate page. Pages with more than two columns. Troff option -o doesn't work with -mpm because only the postprocessor knows the page numbers. MPM(6)
All times are GMT -4. The time now is 10:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy