Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to cut part of a string in reverse? Post 302888987 by nivI on Tuesday 18th of February 2014 08:42:42 AM
Old 02-18-2014
How to cut part of a string in reverse?

Hi,

how to cut part of a string sing delimiter in reverse
input file
Code:
1,2,st-pa-tr-01,2,3,4,
2,3,ff-ht-05,6,7,8

how can i obtain strings till
st-pa-tr
ff-ht i.e cutting the last part og string -01 and -05

Thanks & Regards
Nivi

Moderator's Comments:
Mod Comment edit by bakunin: changed thread title (typo)

Last edited by bakunin; 02-18-2014 at 10:44 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How reverse cut or read rows of lines

Hi, My records are like this BSC403_JAIN03|3153_TropicalFarm_LIMJM1-3_97| BSC403_JAIN03|3410_PantaiAceh_PCEHM1_4_97| BSC406_BMIN02|1433_JomHebohTV3_COW7M1_11_97| I want to extract the value before _97| This command BSC_ID=`echo $DATA | cut -f5 -d"_"` gives me _97|, 4, 11 and by... (16 Replies)
Discussion started by: doer
16 Replies

2. Shell Programming and Scripting

cut part of line

Dear Sirs, I want to cut the IP address from the following text line: " mgmt.mib-2.bgp.bgpPeerTable.bgpPeerEntry.bgpPeerLastError.163.121.170.20 (OctetString): 0x04 00" I want to get the (163.121.170.20) only. Thanks in advance. (8 Replies)
Discussion started by: ahmed.zaher
8 Replies

3. Shell Programming and Scripting

cut a part of the file

This is a part of the output file (x.out, from a chemical software). I need to extract the xyz coordinates with the atom labels from this file.If it's possible i would like to use a bash shell script. I am new to this forum, how can I solve this problem. DIPOLE X Y Z ... (1 Reply)
Discussion started by: kurosaki
1 Replies

4. UNIX for Dummies Questions & Answers

Help me with cut part 2..

Hi, I have this file name : xxx.77876767575.abc.77887.iiii If to get only the xxx i will need to do this command: i=xxx.77876767575.abc.77887.iiii name=`echo $i |cut -f1 -d "."` How do i get 77876767575.abc.77887.iiii without xxx in front? Please advice. Thanks (7 Replies)
Discussion started by: luna_soleil
7 Replies

5. Shell Programming and Scripting

cut a field, but with reverse order

Hi Everyone, I have one a.txt: a b 001 c b b 002 c c c, not 002 c The output should be 001 002 002 If i use cut -f 3 -d' ', this does not work on the 3rd line, so i thought is any way to cut the field counting from the end? or any perl thing can do this?:confused: ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

6. UNIX for Dummies Questions & Answers

How to cut a string in two parts and show the other part

hi everybody.. I have a string like : abcd:efgh xxyy:yyxx ssddf:kjlioi ghtyu:jkksk nhjkk:heuiiue please tell me how i can display only the characters after ":" in the output the output should be : efgh yyxx kjlioi jkksk heuiiue please give quick reply.. its urgent..!! (6 Replies)
Discussion started by: adityamitra
6 Replies

7. UNIX for Dummies Questions & Answers

cut and print part of a string

I have a file that contains: yahoo.com.23456 web.log.common.us.gov.8675 192.168.1.55.34443 john-doe.about.com.22233 64.222.3.4.120 sunny.ca.4442 how can i remove the strings after the last dot (.) and reprint the file? Thanks. (3 Replies)
Discussion started by: apalex
3 Replies

8. Shell Programming and Scripting

CUT command delimiter in reverse

Hi, I've a situation where, a=xxx.yyy.zzz.txt EXTN=`echo $a | cut -d . -f2` Using the above code it delimites and will return "yyy.zzz.txt" to EXTN. But i need to get only the extension "txt". so as per the above code it delimits in the first "." itself. Can anyone help how to do... (6 Replies)
Discussion started by: skcvasanth
6 Replies

9. Shell Programming and Scripting

Cut or awk in reverse

I may be making this too hard on myself, but I'm trying to find a way that I can use a cut or awk string to always remove the last two delimited fields of a string. Say I have PackageName-U939393-8.2.3.4.s390x.rpm But the s390x could be any string w/o periods in it, x8664 for example,... (9 Replies)
Discussion started by: cbo0485
9 Replies

10. Shell Programming and Scripting

cut the some part in filename

Hi All, I have the file & name is "/a/b/c/d/e/xyz.dat" I need "/a/b/c/d/e/" from the above file name. I tryning with echo and awk. But it not come. Please help me in this regard. Thanks & Regards, Dathu (3 Replies)
Discussion started by: pdathu
3 Replies
MOD-ACTIVE(8)						    InterNetNews Documentation						     MOD-ACTIVE(8)

NAME
mod-active - Batch processing of newsgroups creation and removal commands SYNOPSIS
mod-active [ctlinnd-command-file ...] DESCRIPTION
mod-active is a Perl script that updates the active file based on its input lines of ctlinnd "newgroup", "rmgroup" and "changegroup" commands. It pauses the server briefly while the existing active file is read and rewritten, which not only keeps innd from updating the active file but also locks against other instances of mod-active. The script must be run as the news user. The input to mod-active can come either from one or more ctlinnd-command-file files named on the command line, or from the standard input. Typically its input is the output from the docheckgroups or actsync commands. Every line which contains the string "ctlinnd newgroup", "ctlinnd rmgroup", or "ctlinnd changegroup", optionally preceded by whitespace and/or the path to ctlinnd, is noted for the update. Redundant commands, such as a newgroup directive for a group that already exists, are silently ignored. All other lines in the input are also silently ignored. After the new active file has been generated, the existing one is renamed to active.old and the new one is moved into place. The script then displays the differences between the two files. Any groups that were added to the active file are also added to the active.times file with the string "checkgroups-update". Please note that no syntax checking is performed on group names by mod-active. BUGS
Though innd is paused while mod-active works, it is not inconceivable that there could be a conflict if something else tries to update the active file during the relatively short time that mod-active is working. The two most realistic ways for this to happen are either by an administrator concurrently doing a manual ctlinnd command, or by innd receiving a control message, then mod-active pausing the server, then the control message handler script that innd forked running its own ctlinnd command while mod-active is working. Note that such scenarios are very unlikely to happen. HISTORY
Written by David C Lawrence <tale@isc.org> for InterNetNews. Converted to POD by Julien Elie. SEE ALSO
active(5), active.times(5), actsync(8), ctlinnd(8), docheckgroups(8), innd(8). INN 2.5.3 2011-06-10 MOD-ACTIVE(8)
All times are GMT -4. The time now is 03:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy