Sponsored Content
Top Forums Shell Programming and Scripting Insert text between delimiter Post 302173455 by Smiling Dragon on Thursday 6th of March 2008 05:27:32 PM
Old 03-06-2008
Java

There's sure to be a way to do this in sed, but I'm pretty poor with sed so here's some (really ugly) perl:

Code:
#!/usr/bin/perl -w
while (<>) {
  while ($_ =~ s/,,/,NULL,/) { print "" }
  print $_;
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

2. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 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

insert delimiter

I have a data file that I would like to add delimiters to. Example: Turn This: 20110624000744000693000704000764 Into This: 20110624,000744,000693,000704,000764 I found this link but the only issue is I do not know how many colums I will have. The first field would needs to be 8... (9 Replies)
Discussion started by: oldman2
9 Replies

5. Shell Programming and Scripting

Selecting Specific Columns and Insert the delimiter TAB

Hi, I am writing a Perl Script for the below : I have a data file that consists of the header information which is 231 Lines and the footer information as 4 lines. The total number of line including the header and footer 1.2 Million with Pipe Delimited file. For example: Header Information:... (4 Replies)
Discussion started by: filter
4 Replies

6. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

7. Shell Programming and Scripting

[Solved] Insert tabs as delimiter

Hello all, I have an unstructured file with space as delimiter , which I want to structure. The output file should actually have only 5 columns with tab as delimiter. The 4th column can have only 3 values ( biological_process , cellular_component , molecular_function ) Here is how the... (12 Replies)
Discussion started by: ritakadm
12 Replies

8. Shell Programming and Scripting

Insert a new column with sequence number (Delimiter as comma)

Hi All, I have a file which has data like a,b c,d e,f g,h And I need to insert a new column at the begining with sequence no( 1 to n) 1,a,b 2,c,d 3,e,f 4,g,h Please let me know how to acheive this in unix (3 Replies)
Discussion started by: weknowd
3 Replies

9. Shell Programming and Scripting

Linux shell script to insert new lines based on delimiter count

The input file is a .dat file which is delimited by null (^@ in Linux). On a windows PC it looks something like this (numbers are masked with 1). https://i.imgur.com/nta2Gqp.jpg The entire file is in one row but it has multiple records - each record contains 80 fields i.e. there are 81 counts... (9 Replies)
Discussion started by: digitalnirvana
9 Replies

10. Shell Programming and Scripting

Insert a value between two empty delimiter in the file.

Would like to insert value between two empty delimiter and at the very last too if empty. $ cat customerleft.tbl 300|Customer#000000300|I0fJfo60DRqQ|7|17-165-193-5964|8084.92|\N|p fluffily among the slyly express grouches. furiously express instruct||||||||||||||||||||||||\N... (3 Replies)
Discussion started by: Mannu2525
3 Replies
HEXEDITOR(1)						      General Commands Manual						      HEXEDITOR(1)

NAME
hexeditor - Full screen curses Hex editor SYNOPSIS
hexeditor [ -8abdfgqrv ] [ filename ] DESCRIPTION
Hexeditor is an editor to edit binary (or any) files or disks. The Display consists of the current offset from 0 (the first byte), the next sixteen bytes (aligned by bytes or 32-bit words), and its ASCII or EBCDIC text representation. OPTIONS
-h, --help Display help -8, --highbit Display 8-bit text -a, --alltext Display all text regardless that you know better -b, --buffer Buffer the entire file into memory. Faster, and enables insert and delete. -d, --disk File editing is a disk. OpenBSD and Linux only. -f, --force Force editing of a disk. Need this option to enable writing to disks. -q, --quiet Quiet Mode; Turn off all beeping. -r, --readonly Do not allow modifying the file -v, --version Display version number Commands and keys ^A Insert byte Insert Insert byte ^D Delete byte Delete Delete byte ^E viEw as text dump ^F Page down ^V Page down Page Down Page down ^B Page Up ^Y Page Up Alt-V Page Up Page Up Page Up Tab Switch from hex to text representation ^I Switch from hex to text representation ^T goTo offset ^G Get help ^L Redraw screen ^C Quit without saving ^O Save ^X Save and Quit ^W Search (text/hex) ^N find Next ^U Undo ^R ASCII <=> EBCDIC ^P Switch Spacings ^+ Binary Calculator Author Adam Rogoyski <apoc@laker.net> See Also od (1) BUGS
Editing disks is only supported in Linux and OpenBSD. Please email Adam Rogoyski <apoc@laker.net> with any bugs you might find. This man page is intentionally brief. Please Read the included documentation in Texinfo format for additional information HEXEDITOR(1)
All times are GMT -4. The time now is 02:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy