Sponsored Content
Top Forums Shell Programming and Scripting Remove last string from each line Post 302589473 by agama on Wednesday 11th of January 2012 10:04:46 PM
Old 01-11-2012
Quote:
Originally Posted by Davinator
Thanks for the heads up about basename and dirname commands. Your script is much more streamlined.

When I run your command, I get a bunch of errors:
awk: cmd. line:1: {print $(NF)
awk: cmd. line:1: ^ unexpected newline or end of string
find: `basename' terminated by signal 13
find: `basename' terminated by signal 13
find: `basename' terminated by signal 13
find: `basename' terminated by signal 13
....

Thoughts?
Didn't see your post when I posted before. The awk is missing a paren:

Code:
awk -F '-'  '{for(i=1;i<NF;i++ ) {printf("%s ", $i)}; print "" }

It should work if you add that.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove Line that contains specific string

I am looking for a way to remove any line in a text file that contains the string "Mac address". I guess you would grep and sed, but I am not sure how to do this. Thanks for you help. (3 Replies)
Discussion started by: CBarraford
3 Replies

2. Shell Programming and Scripting

How to remove new line char from a string

Hi Can anyone tell me how can i remove new line character from a string. My requirement is to read a line from a file and store it to a string. read line string1=$line read line string2=$line echo $string1$string2 The result i am getting in different line. i want the output in the same... (1 Reply)
Discussion started by: sreedivia
1 Replies

3. Shell Programming and Scripting

Remove Command-Line Option from String

I want to add a "-r <remote_host>" option to my ksh script, causing the script to run a script of the same name on the specified remote host. The remote invocation should itself include all the command-line options of the original invocation, less the -r option. For example, this invocation: ... (7 Replies)
Discussion started by: mattmiller
7 Replies

4. Shell Programming and Scripting

Remove line based on string and put new line with parameter

Hi Folks, I am new to ksh, i have informatica parameter file that i need to update everyday with shell script. i need your help updating this file with new parameters. sample data $$TABLE1_DATE=04-27-2011 $$TABLE2_DATE=04-23-2011 $$TABLE3_DATE=03-19-2011 .......Highligned... (4 Replies)
Discussion started by: victor369
4 Replies

5. Shell Programming and Scripting

Remove last string from last line in a file

Hi, I have a file like : I want to remove last string in last line (here total string is "05550"~). And last line end with ~ character. Output should be : Please help me Thanks in advance (3 Replies)
Discussion started by: mnmonu
3 Replies

6. Shell Programming and Scripting

gawk to remove last character in a line or string

I am outputting a line like this print $2 "/" $4The last character though is a ":" and I want to remove it. Is there any neat way to remove it? Or am I forced to do something like this: print $2 "/" substr($4, 1, length($4) - 1)Thanks. (6 Replies)
Discussion started by: benalt
6 Replies

7. Shell Programming and Scripting

Remove every line with specific string, and also the one above and below it

I would like to identify every line with a specific string, in this case: "Mamma". I would like to remove that line, and also the line above it and below it. So the below Where are all amazing Flats Look At The Great Big White Hey There Hot Mamma You Are So hot Baby I wish You were Mine... (5 Replies)
Discussion started by: phpchick
5 Replies

8. Shell Programming and Scripting

Remove line containing string and renumber

Hello, I have some files in a directory and a short list of strings. I want to loop through the files and remove lines containing the string and renumber. There are some issues. The first is the strings that can contain troublesome characters like single quotes and parenthesis. Here is one... (12 Replies)
Discussion started by: LMHmedchem
12 Replies

9. UNIX for Advanced & Expert Users

Vi remove line range containing a string

In vi I would like to remove a line containing a string. I thought after reading this I could do this. https://www.unix.com/302297288-post3.html :'3560,3572/gcc/d' It keeps complaining vi mark not set. And sometimes it complains E488: Trailing characters. I don't understand what mark... (5 Replies)
Discussion started by: cokedude
5 Replies
PMDANAMED(1)						       Performance Co-Pilot						      PMDANAMED(1)

NAME
pmdanamed - BIND (named) PMDA DESCRIPTION
pmdanamed is a Performance Metrics Domain Agent (PMDA) which exports metric values from the BIND DNS server. Further details on BIND can be found at http://isc.org/. INSTALLATION
If you want access to the names and values for the named performance metrics, do the following as root: # cd $PCP_PMDAS_DIR/named # ./Install If you want to undo the installation, do the following as root: # cd $PCP_PMDAS_DIR/named # ./Remove pmdanamed is launched by pmcd(1) and should never be executed directly. The Install and Remove scripts notify pmcd(1) when the agent is installed or removed. FILES
/var/named/data/named_stats.txt statistics file showing values exported from named /var/named/chroot/var/named/data/named_stats.txt chroot variant of statistics file showing values exported from named $PCP_PMDAS_DIR/named/Install installation script for the pmdanamed agent $PCP_PMDAS_DIR/named/Remove undo installation script for the pmdanamed agent $PCP_LOG_DIR/pmcd/named.log default log file for error messages from pmdanamed SEE ALSO
pmcd(1), named.conf(5), named(8). 3.8.10 Performance Co-Pilot PMDANAMED(1)
All times are GMT -4. The time now is 10:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy