01-31-2006
Hi,
thanks, however irrespective of any number of occurences of tab 'tr' will replace each occurences with single occurence(replacable) chars.
i.e input is
Quote:
line1{1\t}echo{1\t}123{2\t}4567{3\t}111111
line2{1\t}hello{2\t}123{4\t}11111
line3{5\t}1111{1\t}12
note : pls read {1\t} as 1 tab and {2\t} as 2 tabs
the statement cat abc | tr -s '\t' '#' replace any number of occurences on each line to just one. However I wanna retain the number of each occurences in this case number of tabs, so that after processing I can put it back in the respective places.
Hope I'm clear
Last edited by braindrain; 01-31-2006 at 06:49 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Greetings....
I'm looking for the command and syntax to search files, several actually, that will find the string pattern "\0;" and delete it. I have over 200 files to change :o
Thanx (2 Replies)
Discussion started by: karpolu
2 Replies
2. Shell Programming and Scripting
Hi All,
In the HP Unix that i'm using when i initialise a string as Stalled="'30¬G'"
Stalled=$Stalled" '30¬C'", it is taking the character ¬ as a comma. I need to grep for 30¬G 30¬C in a file and take its count. But since this character ¬ is not being understood, the count returns a zero.
The... (2 Replies)
Discussion started by: roops
2 Replies
3. Shell Programming and Scripting
:rolleyes: Hi,
I want to replace the particular text in the middle of the line.
Ex. In the line 40-50 wanted to replace the char as 'x' (7 Replies)
Discussion started by: Jairaj
7 Replies
4. Shell Programming and Scripting
I know this has been asked previously on this forum...But I think I have a different scenario to present.
I ahve a file tht looks like this (note:there are control Z and other chars tht are not visible on line with anme bowers)
BB7118450 6004718 BIANCALANA =HEI
BZ5842819 ... (4 Replies)
Discussion started by: alfredo123
4 Replies
5. Shell Programming and Scripting
Hello,
I am not a programmer, please be patient.
Actually, I have started to look into Perl because it seems to be able to solve all the problems (or most of them) I happen meet using my computer. These problems are generally all text-manipulation-related.
Although I started to study, I cannot... (6 Replies)
Discussion started by: ahsog
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I am getting the data from text file and it contains comma and double quootes.
Eg: text file like this:
Travelling up Cattai Ridge Rd, going through the "S" bends at the top.
Felt a "pull" and pain in groin area, on right side after lifting at work.
Repeat "twisting" while working manual... (4 Replies)
Discussion started by: rajesh4851
4 Replies
7. Shell Programming and Scripting
Hello,
I have a csv file with "^" as text delimiters and "|" as field delimiters. It's converted from a xls file. One record looks like this:
^Tablete Internet^|Archos|501838|^Tableta Internet ARCHOS 80 G9
...| ...
(more lines)
... "501|838"^|330.00|USD|sl|12|0|Link|^router wireless 150... (10 Replies)
Discussion started by: go0ogl3
10 Replies
8. UNIX for Dummies Questions & Answers
HI All
Im trying to come up with an approach to finding a string, using a portion of that string to insert it on lines starting with the value "GOTO" appending to end of line after removing PT's ( See example below! )
EXAMPLE:
1. I would like to search for the line that starts with "TLAXIS/"... (7 Replies)
Discussion started by: graymj
7 Replies
9. Shell Programming and Scripting
We are getting extended Ascii characters in the input file and my requirement is to search and replace them with a space. I am using the following command
LANG=C sed -e 's// /g'
It is doing a good job, but in some cases it is replacing the extended characters with two spaces. So my input... (12 Replies)
Discussion started by: ysvsr1
12 Replies
10. Shell Programming and Scripting
hi. I have a requirement where I need to REPLACE all alphabets from an alphanumeric input string into their respective ASCII decimal value. For example:
If the input string is ABAC123, the output should be 65666567123
I am seeking a single line command, and I was trying searching for options... (21 Replies)
Discussion started by: kumarjt
21 Replies
LEARN ABOUT DEBIAN
strgsub
/* Part of publib.
Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved.
Redistribution and use in source and binary forms, with or
without
modification, are permitted provided that the following condi-
tions
are met:
1. Redistributions of source code must retain the above copy-
right
notice, this list of conditions and the following dis-
claimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials pro-
vided
with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EX-
PRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IM-
PLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSE-
QUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTI-
TUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
STRGSUB(3pub) C Programmer's Manual STRGSUB(3pub)
*/
NAME
strgsub - substitute all occurences of pattern with another string
SYNOPSIS
#include <publib.h>
int strgsub(char *str, const char *pat, const char *sub, size_t max);
DESCRIPTION
strgsub finds all occurences of the pattern pat in the string str (using a method similar to strstr(3) to find the occurrences, i.e., no
regular expressions), and replaces each with sub. If pat does not occur in str, no substitution is made. The size (including the terminat-
ing '