Sponsored Content
Top Forums Shell Programming and Scripting Removing date field from the string Post 302926724 by sea on Wednesday 26th of November 2014 11:45:05 AM
Old 11-26-2014
Quote:
Originally Posted by rbatte1
You could use variable substitution in the shell too to save the cost of awk, but if the above works and you're not in a large loop then you may be happy already.


Robin
Is there a better way than?
Code:
string=ODS_EPP_COVRG_STN_DETL_FILE_10032014.TXT
echo ${string/_[0-9]*/.TXT}

Output:
Code:
ODS_EPP_COVRG_STN_DETL_FILE.TXT

hth
This User Gave Thanks to sea For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing last field of the line

I have a text file containing /database/sp/NTR_Vlr_Upload.sql /database/tables/StatsTables.sql /mib/ntr.mib /mib/ntr.v2.mib /scripts/operations/ntr/IMSITracer.ph i want the last field after "/" removed like /database/sp/ /database/tables/ /mib/ /mib/ ... (4 Replies)
Discussion started by: adddy
4 Replies

2. Shell Programming and Scripting

Removing parts of a specific field

All, I have a field in a comma seperated file with hundreds of lines and about 20 columns and I wish to remove all numbers after the decimal point in field 4 on each line and output the rest to another file or write it back to itself. File is like this 20070126, 123.0, GBP, 1234.5678,... (9 Replies)
Discussion started by: kieranh
9 Replies

3. Shell Programming and Scripting

Removing duplicate field from MARC Record

Hello, I'm new to Perl programming and I have a duplicate 035 tag Voyager application field. The first 035 tag has the information I need but the second 035 tag created the bib id, which I don't need. This incident was performed on several records so I would have to run this script on several... (1 Reply)
Discussion started by: rcnick
1 Replies

4. Shell Programming and Scripting

Awk Search text string in field, not all in field.

Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below. awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies

5. UNIX for Dummies Questions & Answers

Removing spaces in the second field alone

Consider my input string as "abc|b f g|bj gy" I am expecting the output as "abc|bfg|bj gy". Please let me know how to achieve this in unix? Thanks (8 Replies)
Discussion started by: pandeesh
8 Replies

6. Shell Programming and Scripting

removing a particular field from some of the lines in a filed

Hi All, i have a file having multiple lines but mainly constitues of following two types 1) Sat,Oct,1,01:04:51,2011,Local,ESSBASE0,Info(1051037),Logging,out,user,210073155,,,active,for,63,minutes,GETS_SAL,loaded 2)... (2 Replies)
Discussion started by: dev.devil.1983
2 Replies

7. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies

8. Shell Programming and Scripting

Removing duplicated first field rows

Hello, I am trying to eliminate rows where the first field is duplicated, leaving the row where the last field is "NET". Data file: 345234|22.34|LST 546543|55.33|LST 793929|98.23|LST 793929|64.69|NET 149593|49.22|LST Desired output: 345234|22.34|LST 546543|55.33|LST... (2 Replies)
Discussion started by: palex
2 Replies

9. Shell Programming and Scripting

Removing line breaks inside a field

Hi all, I have a csv input file with total 60 fields and the fields are not enclosed with double quotes.One of the field(50th field) in this file has line breaks in it which results in the row getting split into multiple lines.This is causing my load(to table) to fail.I tried to enforce double... (3 Replies)
Discussion started by: Bobby_2000
3 Replies

10. UNIX for Beginners Questions & Answers

awk Associative Array and/or Referring to Field by String (Nonconstant String Value)

I will start with an example of what I'm trying to do and then describe how I am approaching the issue. File PS028,005 Lexeme HRS # M # PhraseType 1(1:1) 7(7) PhraseLab 501 503 ClauseType ZYq0 PS028,005 Lexeme W # L> # BNH # M #... (17 Replies)
Discussion started by: jvoot
17 Replies
Net::DNS::RR::TXT(3)					User Contributed Perl Documentation				      Net::DNS::RR::TXT(3)

NAME
Net::DNS::RR::TXT - DNS TXT resource record SYNOPSIS
use Net::DNS; $rr = new Net::DNS::RR( 'name TXT txtdata ...' ); $rr = new Net::DNS::RR( name => 'name', type => 'TXT', txtdata => 'single text string' ); $rr = new Net::DNS::RR( name => 'name', type => 'TXT', txtdata => [ 'multiple', 'strings', ... ] ); use utf8; $rr = new Net::DNS::RR( 'jp TXT XXXXXXXXXXXX' ); DESCRIPTION
Class for DNS Text (TXT) resource records. METHODS
The available methods are those inherited from the base class augmented by the type-specific methods defined in this package. Use of undocumented package features or direct access to internal data structures is discouraged and could result in program termination or other unpredictable behaviour. txtdata $string = $rr->txtdata; @list = $rr->txtdata; $rr->txtdata( @list ); When invoked in scalar context, txtdata() returns the descriptive text as a single string, regardless of the number of elements. In a list context, txtdata() returns a list of the text elements. COPYRIGHT
Copyright (c)2011 Dick Franks. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. Package template (c)2009,2012 O.M.Kolkman and R.W.Franks. SEE ALSO
perl, Net::DNS, Net::DNS::RR, RFC1035 Section 3.3.14, RFC3629 perl v5.18.2 2014-01-16 Net::DNS::RR::TXT(3)
All times are GMT -4. The time now is 09:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy