Sponsored Content
Top Forums UNIX for Dummies Questions & Answers cut and print part of a string Post 302439801 by radoulov on Friday 23rd of July 2010 06:11:17 PM
Old 07-23-2010
Do you want to remove the last dot as well?

Code:
sed 's \.[^.]*$  ' infile

This User Gave Thanks to radoulov For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I get awk to print a " in it's print part?

The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }' I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ". Thanks. (2 Replies)
Discussion started by: LordJezo
2 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. 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

6. Shell Programming and Scripting

Select a specific part of the string and print it

Hi all, I have a string that looks like: #!/bin/sh options="arguments: --user=alpha --group=beta --prefix=/usr/share --proxy-path=/proxy --proxy-tmp=/tmp --conf-path=/etc" My goal is to transform the string into an array, then for each key, if it starts with "--proxy" to print the string... (2 Replies)
Discussion started by: TECK
2 Replies

7. UNIX for Dummies Questions & Answers

Print part of string

I have a file called file.txt It contains strings: ALT=someone@acme.com TO=whoever@lalalulu.com How could find and print the actual address after the = sign for any given instance? I need the command to print one of them - for example someone@acme.com But have in mind that this... (3 Replies)
Discussion started by: svetoslav_sj
3 Replies

8. UNIX for Dummies Questions & Answers

How to cut part of a string in reverse?

Hi, how to cut part of a string sing delimiter in reverse input file 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 edit by bakunin: changed thread title (typo) (3 Replies)
Discussion started by: nivI
3 Replies

9. Shell Programming and Scripting

Print particular string in a field of csv file - part 2

Hi, all I need your help and suggestions. I want to print particular strings in a field of a csv file and show them in terminal. Here is an example of the csv file. SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw... (7 Replies)
Discussion started by: refrain
7 Replies
POSTFIX2DLF_PRE.IN(1)					  LogReport's Lire Documentation				     POSTFIX2DLF_PRE.IN(1)

NAME
postfix2dlf_pre - preprocess postfix logfiles for postfix2dlf_main SYNOPSIS
postfix2dlf_pre dumpfile DESCRIPTION
postfix2dlf_pre expect a postfix logfile on STDIN. It prints preprocessed logfile lines to STDOUT and creates a Berkeley DB holding a mapping from hostname-queueid to number-of-lines-with-this-id. dumpfile can be e.g. /tmp/dump, ../../var/dump or dump. DEVELOPERS
One can use the lr_anondump tool to view the contents of the dumpfile. E.g. run $ zcat postfix.log.gz | ./postfix2dlf_pre /tmp/stem > /tmp/pre $ lr_anondump /tmp/stem $ ./postfix2dlf_main /tmp/stem < /tmp/pre > /tmp/post . EXAMPLE
The raw log file Dec 1 04:02:56 internetsrv postfix/pickup[20919]: 693A3578E: uid=0 from=<root> Dec 1 04:02:56 internetsrv postfix/cleanup[20921]: 693A3578E: message-id=<john.doe.1@example.com> Dec 1 04:02:57 internetsrv postfix/qmgr[20164]: 693A3578E: from=<john.doe.2@example.com>, size=617 (queue active) Dec 1 04:02:58 internetsrv postfix/local[20924]: 693A3578E: to=<john.doe.2@example.com>, relay=local, delay=3, status=sent (forwarded as E325C578D) will get converted to dlfid internetsrv693A3578E from_relay_host localhost from_relay_ip 127.0.0.1 logrelay internetsrv queueid 693A3578E time 1007175776 type pickup dlfid internetsrv693A3578E logrelay internetsrv msgid <john.doe.1@example.com> queueid 693A3578E time 1007175776 type cleanup dlfid internetsrv693A3578E from_domain example.com from_relay_host localhost from_relay_ip 127.0.0.1 from_user john.doe.2 logrelay internetsrv queueid 693A3578E size 617 time 1007175777 type qmgr delay 3 dlfid internetsrv693A3578E logrelay internetsrv queueid 693A3578E stat sent time 1007175778 to_domain example.com to_relay_host localhost to_relay_ip 127.0.0.1 to_user john.doe.2 type local xstat (forwarded_as_e325c578d) EXAMPLES
postfix2dlf_pre will be rarely used on its own: it is called by postfix2dlf(1). Refer to the postfix2dlf manpage for examples and usage information. SEE ALSO
postfix2dlf(1), postfix2dlf_main(1), sendmail2dlf(1), qmail2dlf(1), exim2dlf(1) VERSION
$Id: postfix2dlf_pre.in,v 1.13 2006/07/23 13:16:34 vanbaal Exp $ COPYRIGHT
Copyright (C) 2002 Stichting LogReport Foundation LogReport@LogReport.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. AUTHOR
Joost van Baal Lire 2.1.1 2006-07-23 POSTFIX2DLF_PRE.IN(1)
All times are GMT -4. The time now is 12:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy