Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Trying to remove single character from a line Post 302125790 by Iz3k34l on Saturday 7th of July 2007 01:29:21 PM
Old 07-07-2007
update on Ghostdog usage

thanks for your help.

some of the problems i was having was removing the B from the DOB line. along with the B from the Phone nums.

HOME# cat user2.txt
PT: DARRELL SMITH
PTDOB: 12/15/98
RP: DARRELL SMITH SR
PTSSN: 558-55-1234
RPSSN: 554-55-1234
HMNUM: 213-555-1234B
RPNUM: 213-555-1234
POENUM: 213-555-1234B
HMADDY: 123 A yourstreet Los Angeles CA 90504
POENAME:
POEADDY:
CLIENT: TMC
DOS: 05/07/05

After trying many diff things i changed ghostdog's example and viola

awk '//{gsub(/B$/,"")}{print}' user2.txt


and now th results are in

HOME# awk '//{gsub(/B$/,"")}{print}' user2.txt
PT: DARRELL SMITH
PTDOB: 12/15/98
RP: DARRELL SMITH SR
PTSSN: 558-55-1234
RPSSN: 554-55-1234
HMNUM: 213-555-1234
RPNUM: 213-555-1234
POENUM: 213-555-1234
HMADDY: 123 A yourstreet Los Angeles CA 90504
POENAME:
POEADDY:
CLIENT: TMC
DOS: 05/07/05
HOME#

Thanks GDog
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove Last Character of Line

Hi, I need to put the single line contents of a file into a variable, but remove the last character, for example the file would have this sort of contents: 2;4;3;10;67;54;96; And I want the variable to be: 2;4;3;10;67;54;96 (notice the last ";" has gone). Unfortunately I can't just... (4 Replies)
Discussion started by: danhodges99
4 Replies

2. Programming

remove single-line comment

Does anyone knows how to write a program to remove single-line comment in C program? that means it don't read anything behind // (3 Replies)
Discussion started by: Icy002
3 Replies

3. Shell Programming and Scripting

Looking for a single line to count how many times one character occurs in a word...

I've been looking on the internet, and haven't found anything simple enough to use in my code. All I want to do is count how many times "-" occurs in a string of characters (as a package name). It seems it should be very simple, and shouldn't require more than one line to accomplish. And this is... (2 Replies)
Discussion started by: Shingoshi
2 Replies

4. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

5. Shell Programming and Scripting

Reading a single character from each line of the file

Hi, I should read one character at a fixed position from each line of the file. So how ??? should be substituted in the code below: while read line ; do single_char=`???` echo "$single_char" done < $input_file (8 Replies)
Discussion started by: arsii
8 Replies

6. Shell Programming and Scripting

How to remove , if first character on line

Hi, I have a file with lines such as the below. I want to remove the comma only if it is the first character on a line. I can't work out how to do this using sed. *ELSET, ELSET=WHEEL_TD2 63, 64, 65, 72, 82, 88, 89, 92, 120, 121, 152, 181, 190, 221, 252, 259 , 260, 282, 283, 285, 286,... (2 Replies)
Discussion started by: carlr
2 Replies

7. UNIX for Dummies Questions & Answers

Remove last character in each line

Hi guys, Does anyone know how to remove the last character in each of the line? This is what I have: ABCDE.1 GLSJD.2 HIJPL.2 HKAGB.3 IUBWQ.1 What I want (remove the dot and number): ABCDE GLSJD HIJPL HKAGB IUBWQ I tried to use this: sed 's/.*//' But I'm not sure if that is... (3 Replies)
Discussion started by: narachaid
3 Replies

8. UNIX for Dummies Questions & Answers

Remove multi line and single line comments

Hi, I am trying to remove multi line and single line comments like examples below I have tried this pattern. it works fine for single line comments and multi line comments in a single line only. but this fails when the comments are extended in multiple lines as shown in the comment 2 of... (3 Replies)
Discussion started by: ahmedwaseem2000
3 Replies

9. Shell Programming and Scripting

Remove single-line breaks only in document

Regarding copy/pasted text of copyright-free book from archive.org (link below), in attempt to expand single-line-break paragraph text (not section headings or paragraph breaks) to wider right margin, Justify or Wrap in LIbreOffice is not working, and Find/Replace the paragraph mark ($) wraps all... (2 Replies)
Discussion started by: p1ne
2 Replies

10. Shell Programming and Scripting

Remove single @ on line from file

Hi All, So I have to remove all the @hostnames from a file, the problem is, there are instances where @ is used for other things... For example: example text: @This is some text in between some at signs@ @This is some more text@ This is a line that will contain a username and his/her... (5 Replies)
Discussion started by: joeg1484
5 Replies
lprm(1) 							    Apple Inc.								   lprm(1)

NAME
lprm - cancel print jobs SYNOPSIS
lprm [ -E ] [ -U username ] [ -h server[:port] ] [ -P destination[/instance] ] [ - ] [ job-id(s) ] DESCRIPTION
lprm cancels print jobs that have been queued for printing. If no arguments are supplied, the current job on the default destination is canceled. You can specify one or more job ID numbers to cancel those jobs or use the - option to cancel all jobs. OPTIONS
The lprm command supports the following options: -E Forces encryption when connecting to the server. -P destination[/instance] Specifies the destination printer or class. -U username Specifies an alternate username. -h server[:port] Specifies an alternate server. CONFORMING TO
The CUPS version of lprm is compatible with the standard Berkeley command of the same name. EXAMPLES
Cancel the current job on the default printer: lprm Cancel job 1234: lprm 1234 Cancel all jobs: lprm - SEE ALSO
cancel(1), lp(1), lpq(1), lpr(1), lpstat(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT
Copyright (C) 2007-2017 by Apple Inc. 22 May 2014 CUPS lprm(1)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy