Sponsored Content
Full Discussion: awk to remove last two -*-*
Top Forums Shell Programming and Scripting awk to remove last two -*-* Post 302751945 by Scrutinizer on Saturday 5th of January 2013 03:10:42 AM
Old 01-05-2013
Try:
Code:
awk 'NF-=2{$1=$1}1' FS=- OFS=- file

Code:
sed 's/-[^-]*-[^-]*$//' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove ^Z (eof) using sub in awk

I am looking for the substitution expression to remove the eof ^Z character at the end of a file in UNIX. Can anyone help? Thank you ! (2 Replies)
Discussion started by: placroix1
2 Replies

2. Shell Programming and Scripting

Remove prefix using awk

Remove prefix using awk File: nawk -F"|" '{if ($1 ~ /^xyz./) print; else { gsub(.*\..*, \..*, $1) ;print }}' file Error: ouput required: (5 Replies)
Discussion started by: pinnacle
5 Replies

3. Shell Programming and Scripting

a SED/AWK way to remove everything except...

Hi all, I have a logfile which has lines as following: DOMAIN\username,Deposit,DOMAIN\ServiceAccountName,25/03/2010,00:10,\\SERVER,,,,/Ts=4BAA9BD6,,,10.00,10.03 It's a log of a pcounter print charge system. I need to only have the first part (domain\username) and the second last... (4 Replies)
Discussion started by: necron
4 Replies

4. Shell Programming and Scripting

AWK remove string in between ()

Hi Everyone, 1.txt test here (888_f)a/fff (eeee) test2 (q)--(qq) the output is test here a/fff test2 -- means remove the characters in between (), and () itself. Please advice. Thanks (3 Replies)
Discussion started by: jimmy_y
3 Replies

5. Shell Programming and Scripting

can I remove the first char using AWK?

Hi everyone, suppose that I have the following line: #test your knowledge can I use AWK to print the word "test" only? without the #? what should I change to this: awk '{print $1}' thanks in advance guys (2 Replies)
Discussion started by: Abdulelah
2 Replies

6. Shell Programming and Scripting

Awk: Remove Duplicates

I have the following code for removing duplicate records based on fields in inputfile file & moves the duplicate records in duplicates file(1st Awk) & in 2nd awk i fetch the non duplicate entries in inputfile to tmp file and use move to update the original file. Requirement: Can both the awk... (4 Replies)
Discussion started by: siramitsharma
4 Replies

7. Shell Programming and Scripting

awk remove first duplicates

Hi All, I have searched many threads for possible close solution. But I was unable to get simlar scenario. I would like to print all duplicate based on 3rd column except the first occurance. Also would like to print if it is single entry(non-duplicate). i/P file 12 NIL ABD LON 11 NIL ABC... (6 Replies)
Discussion started by: sybadm
6 Replies

8. Shell Programming and Scripting

awk remove line

I would like to remove lines with certain pattern but only Estimate: and Realised: in USD and Date: shall be output. The order of the currency are mixed. Output I failed on awk with sub, gensub and was not able to remove the multiple entry on the * Date: (2 Replies)
Discussion started by: sdf
2 Replies

9. Shell Programming and Scripting

How can I remove first column with awk?

cat input.txt a x b y c z Expected output x y z (11 Replies)
Discussion started by: cola
11 Replies

10. UNIX for Beginners Questions & Answers

Remove character \r and \n in awk

Hi Everybody: I need your help, please... I have this file *.txt 0000 | 16010201 22000000 67892000 00000000 00000000 00000100 72246681 28E08236 | ~~~~"~~~g~ ~~~~~~~~~~~~~r$f~(~~6 | 0020 | 10476173 90010100 10000000 00000001 05000226 17163011 12442212 48140484 |... (2 Replies)
Discussion started by: solaris21
2 Replies
Locale::Codes::LangVar(3)				User Contributed Perl Documentation				 Locale::Codes::LangVar(3)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('arevela','alpha'); $lvar = code2langvar('arevela',LOCALE_LANGVAR_ALPHA); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-04-12 Locale::Codes::LangVar(3)
All times are GMT -4. The time now is 03:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy