05-10-2005
Need to replace text in an awk
Hey guys:
Running Solaris 5.5.1 and trying to write an easy /bin/sh script. Here is what I am doing...
grep "Total" /workspace_4/local/reports/cust_calls_5ess.050510 | awk '{print $4 "\t" $7 $8 $9 $10 $11 $12 $13 $14}'
It renders the following results...
315268 CLARKSONUNIVERSITYis:1485
516286 BROOKHAVENHOSPITALis:8372
516231 CITIBANKis:1247
978796 DMATSAYERis:3447
718239 NYSBRONXCHILDRENPSY.CTRis:778
508875 DMATSFRAM2is:5759
781378 DMATSLEXTN2is:20826
914285 CITYOFWHITEPLAINSis:5154
What I would like to do is replace the "is:" above with a <TAB>, so that it looks more like this...
315268 CLARKSONUNIVERSITY 1485
516286 BROOKHAVENHOSPITAL 8372
516231 CITIBANK 1247
978796 DMATSAYER 3447
718239 NYSBRONXCHILDRENPSY.CTR 778
508875 DMATSFRAM2 5759
781378 DMATSLEXTN2 20826
914285 CITYOFWHITEPLAINS 5154
The tricky part is that I have to print $7 thru $14 everytime so that I make sure to capture all of the info. I can't simply leave off $13 or $14, for example, because I might miss data dependin on how long the line is.
Any ideas???
-cd
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a text file with following content (3 lines)
filename : output.txt
first line:12/12/2008
second line:12/12/2008
third line:Y
I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before.
I tried using cat output.txt... (4 Replies)
Discussion started by: santosham
4 Replies
2. Shell Programming and Scripting
Howdy!
I'm trying to automate editing of a configuration file (custom.conf for GDM). I need to find every line between a line that starts with "" and the next line that starts with "", I want to preserve that line, but then delete all the lines in that configuration section and then insert... (3 Replies)
Discussion started by: TXTad
3 Replies
3. Shell Programming and Scripting
hello all
greeting for the day
i have a text file as the following
text.xml
abcd<FIELD>123.456</FIELD>efgh
i need to replace the value between <FIELD> and </FIELD> by using awk command.
please throw some light on this.
thank you very very much
Erik (5 Replies)
Discussion started by: erikshek
5 Replies
4. Shell Programming and Scripting
Hi.
I would like to have experts help on below action.
I have text files in which page nubmers exists in form like
PAGE : 1
PAGE : 2
PAGE : 3 and so on there is other text too. I would like to know is it possible to check the last occurance of Page... (6 Replies)
Discussion started by: lodhi1978
6 Replies
5. Shell Programming and Scripting
My apologies if this has been answered in a previous post. I've been doing a lot of searching, but I haven't been able to find what I was looking for. Specifically, I am wondering if I can utilize sed and/or awk to locate two strings in a file, and replace everything between those two strings... (12 Replies)
Discussion started by: kiddsupreme
12 Replies
6. Shell Programming and Scripting
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Discussion started by: dazhoop
2 Replies
7. Shell Programming and Scripting
Hello,
Some time ago a helpful awk file was provided on the forum which I give below:
NR==FNR{A=$0;next}{for(j in A){split(A,P,"=");for(i=1;i<=NF;i++){if($i==P){$i=P}}}}1
While it works beautifully on English and Latin characters i.e. within the ASCII range of 127, the moment a character beyond... (6 Replies)
Discussion started by: gimley
6 Replies
8. Shell Programming and Scripting
I have a record in below format
| msg1 | msg2 | msg3 | - | msg4
I am looking for output
mm/mon/yyyy | 01:23:59 | msg1 | msg2 | msg3 | msg4
I am trying to look in awk to make the above change
So far to avoid columns i tried
cat file | awk -F'|' '{$2=$3="";print $0}'
but i... (2 Replies)
Discussion started by: Tomlight
2 Replies
9. Debian
Good Day Every one
I have a problem finding and replacing text in some large files that will take a long time to manually edit.
Example text file looks like this
#Example Large Text File
unix
linux
dos
squid
bind
dance
bike
car
plane
What im trying to do is to edit all the... (4 Replies)
Discussion started by: linuxjunkie
4 Replies
10. UNIX for Beginners Questions & Answers
Hello Everyone,
I have many files like so:
file1.txt
file2.txt
file3.txt
Within each file I have many lines of random text separated by commas like so:
abcAAA,123,defAA,456777,ghiA,789
jklB,101,mnoBBB,11211,pqrB,13111
stuCC,415,vwxCCCC,161,yzaC,718
I am trying to use SED or AWK to... (4 Replies)
Discussion started by: D3U5X
4 Replies
LEARN ABOUT SUSE
gst-feedback
gst-feedback-0.8(1) User Commands gst-feedback-0.8(1)
NAME
gst-feedback-0.8, gst-feedback - generate debug information for GStreamer bug reports
SYNOPSIS
gst-feedback-0.8
gst-feedback [--gst-list-mm] [--gst-mm=string] [--print]
DESCRIPTION
gst-feedback-0.8 scans the system for various types of information that is useful to GStreamer developers to help diagnose user problems.
Depending on the type of bug report, it might be useful to attach gst-feedback output when you contact the developers.
Note: The current version of this script scans many directories: /usr/lib, /usr/local/lib, /home, /usr/include, /usr/local/include, and
/home (again) for various GStreamer installations. Depending on your system, you might not want to do this.
Note: gst-feedback-0.8 dumps a lot of information about a system. Some of this information might be considered sensitive. If this is a
concern, review the information before posting to a public forum such as the GStreamer bug tracking system.
gst-feedback is a wrapper script that runs the latest installed version of gst-feedback-X.X. For example, if both gst-feedback-0.7 and gst-
feedback-0.8 are installed on your system, gst-feedback runs gst-feedback-0.8.
OPTIONS
The following options are supported by gst-feedback only:
--gst-list-mm List found major/minor versions. This option displays the versions that are available.
--gst-mm=string Force major/minor version. This option enables you to specify a specific version to run, if you do not want to run the
default version.
--print Print wrapped command line. This option displays the command that will be run, and then runs the command.
EXAMPLES
Example 1: Generating Feedback Information
example% gst-feedback-0.8
Example 2: Generating Feedback Information and Redirecting Output and Errors to a File
example% gst-feedback-0.8 &> myfeedback
Example 3: Running the Wrapper Script and Displaying the Command Name
example% gst-feedback --print
/usr/bin/gst-feedback-0.8
FILES
The following files are used by this application:
/usr/bin/gst-feedback-0.Executable to generate debug info for GStreamer bug reports
/usr/bin/gst-feedback Wrapper script that runs the latest installed version of gst-feedback-X.X
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWgnome-media |
+-----------------------------+-----------------------------+
|Interface stability |External |
+-----------------------------+-----------------------------+
SEE ALSO
gst-complete(1), gst-compprep(1), gst-inspect(1), gst-launch(1), gst-launch-ext(1), gst-md5sum(1), gst-register(1), gst-thumbnail(1), gst-
typefind(1), gst-xmlinspect(1), gst-xmllaunch(1), gstreamer-properties(1), libgstreamer-0.8(3), libgstgetbits(3)
NOTES
Original man page written by the GStreamer team at http://gstreamer.net/.
Updated by Brian Cameron, Sun Microsystems Inc., 2004.
SunOS 5.10 14 Oct 2004 gst-feedback-0.8(1)