![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need help with replacing a certain field... | shennanigan83 | Shell Programming and Scripting | 5 | 04-09-2008 02:00 AM |
| Replacing text | chrchcol | Shell Programming and Scripting | 3 | 07-25-2006 01:30 PM |
| Replacing certain field | charbel | Shell Programming and Scripting | 1 | 04-26-2006 05:00 PM |
| replacing text | ajaya | Shell Programming and Scripting | 2 | 04-12-2006 01:31 PM |
| Replacing the last field of a line. | Darek | Shell Programming and Scripting | 3 | 08-19-2005 12:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
replacing a nul field with text
Ok here's my pickle. I have a file in which every line must be the same length. Each field within the line is a certain length. None of these can be changed. What I need to do is look at a specific field within this file, let's say it starts with character 30 and ends with 50. If this field is empty, I need it to be replaced with a bit of text. An example. Note that field 3 below in the first line is blank. I need to make it look like line2. Also, it should ignore the line if there is anything at all in the field as in line 2 and 3. Code:
field1field2 field4 field1field2field3 field4 field1field2sometext field4 Any help would be appreciated as I'm horrible with sed. Last edited by DarkHound; 08-27-2007 at 09:41 AM.. Reason: Wanted to fix offsets, apparently the board [code] tags do not use monospaced fonts. |
|
||||
|
Unfortunately I can't provide an example, it's confidential patient data and can't exactly be sanitized. I can however provide what character/column the field begins and ends at. The field starts at colum 308 and ends at column 327. Instead of being blank, I want the field to contain "See Free Text" without the quotes.
No I do not want to change the size of the line in any way. The field, nor the line containing the field can not change in size, otherwise the importer has a fit. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|