Sponsored Content
Top Forums Shell Programming and Scripting Handling special characters using awk Post 302144541 by sam_78_nyc on Thursday 8th of November 2007 04:55:22 PM
Old 11-08-2007
Thanks

Yep...works great.
Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/sed with special characters

i have this script that searches for a pattern. However it fails if the pattern includes some special characters. So far, it fails with the following strings: 1. -Cr 2. $Mj 3. H'412 would a sed or awk be more effective? i don't want the users to put the (\) during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies

2. UNIX for Advanced & Expert Users

handling special characters

Hello everyone, I use Samba to copy mp3 files to my Red Hat 8.0 box so I can randomize them through a playlist. When I copy: Sigur Rós-Nýja Lagið.mp3 It shows in the mapped drive on Windows as: Sigur Rós-N_ja Lagi_.mp3 And via Putty as: Sigur R(grayed box)s-N_ja Lagi_.mp3 What is going... (1 Reply)
Discussion started by: effigy
1 Replies

3. Shell Programming and Scripting

Problem with awk while handling special charaters

Hi, I have an application.xml file like </dependency> <artifactId>_AdminServicesEAR</artifactId> <version>1.0.0-20080521.085352-1</version> <context-root>oldvalue</context-root> <type>ear</type> <DOCTYPE "abc/xyz/eft"> <NewTag>value123</xyz> ... (4 Replies)
Discussion started by: subin_bala
4 Replies

4. Shell Programming and Scripting

special characters handling in perl

Hi, Here is my piece of code-- sub per_user_qna_detail { for($index=0;$index<@records;$index++) { if($records =~ m/^(.*)\s*Morocco.*Entering\s*Module::authenticate/) { printf "INSIDE per_user_qna_detail on LINE NO $index\n"; $Time_Stamp = $1;... (0 Replies)
Discussion started by: namishtiwari
0 Replies

5. Shell Programming and Scripting

awk print $1 escape all special characters

I'm using awk '{print $1}' and it works most of the time to print the contents of a mysql query loop, but occationally I get a field with some special character in it, is there a way to tell awk to ignore all special characters between my FS? I have >186K records, so building a list of ALL special... (6 Replies)
Discussion started by: unclecameron
6 Replies

6. Shell Programming and Scripting

awk loop: display special characters

Hi everybody; I have a code and this fetches data from first.txt,modify it and outputs it to second.txt file. l awk 'NR>1 {print "l ./gcsw "$1" lt all lset Data="$2" Value "$3}' /home/gcsw/first.txt > /home/gcsw/second.txt this outputs as: l ./gcsw 123 lt all lset Data=456 Value 789 ... (1 Reply)
Discussion started by: gc_sw
1 Replies

7. UNIX for Dummies Questions & Answers

awk for removing special characters and extra commas

Hi, I have a .csv file which as empty lines with comma and some special characters in 3rd column as below. Source data 1,2,3,4,%#,6 ,,,,,, 1,2,3,4,5,6 Target Data 1,2,3,4,5,6I need to remove blank lines and special charcters I am trying to get this using the below awk awk -F","... (2 Replies)
Discussion started by: shruthidwh
2 Replies

8. Shell Programming and Scripting

awk conditions failing (special characters?)

This is really frustrating because I can't figure it out. I'm running a health check script. One of the items I'm checking is the amount of memory on a server. I use the free command, which outputs something like this (excerpt) Mem: 100 100 100 100 Swap: 100 100 100 100 In my debugging... (5 Replies)
Discussion started by: JustaDude
5 Replies

9. Shell Programming and Scripting

Handle special characters in awk -F

Hello Folks, Need to bisect strings based on a subset. Below works good. echo /a/b/c/d | awk -F"/c/d$" '{print $1}' /a/b However, it goes awry with special characters. echo /a/b/c+/d | awk -F"/c+/d$" '{print $1}' /a/b/c+/d Desired output: /a/b Escaping the special characters... (11 Replies)
Discussion started by: vibhor_agarwali
11 Replies

10. Shell Programming and Scripting

Awk: split column if special characters

Hi, I've data like these: Gene1,Gene2 snp1 Gene3 snp2 Gene4 snp3 I'd like to split line if comma and then print remaining information for the respective gene. My code: awk '{ if($1 ~ /,/){ n = split($0, t, ",") (7 Replies)
Discussion started by: genome
7 Replies
FITCIRCLE(l)															      FITCIRCLE(l)

NAME
fitcircle - find mean position and pole of best-fit great [or small] circle to points on a sphere. SYNOPSIS
fitcircle [ xyfile ] -Lnorm [ -H[nrec] ] [ -S ] [ -V ] [ -: ] [ -bi[s][n] ] DESCRIPTION
fitcircle reads lon,lat [or lat,lon] values from the first two columns on standard input [or xyfile]. These are converted to cartesian three-vectors on the unit sphere. Then two locations are found: the mean of the input positions, and the pole to the great circle which best fits the input positions. The user may choose one or both of two possible solutions to this problem. The first is called -L1 and the second is called -L2. When the data are closely grouped along a great circle both solutions are similar. If the data have large dispersion, the pole to the great circle will be less well determined than the mean. Compare both solutions as a qualitative check. The -L1 solution is so called because it approximates the minimization of the sum of absolute values of cosines of angular distances. This solution finds the mean position as the Fisher average of the data, and the pole position as the Fisher average of the cross-products between the mean and the data. Averaging cross-products gives weight to points in proportion to their distance from the mean, analogous to the "leverage" of distant points in linear regression in the plane. The -L2 solution is so called because it approximates the minimization of the sum of squares of cosines of angular distances. It creates a 3 by 3 matrix of sums of squares of components of the data vectors. The eigenvectors of this matrix give the mean and pole locations. This method may be more subject to roundoff errors when there are thousands of data. The pole is given by the eigenvector corresponding to the smallest eigenvalue; it is the least-well represented factor in the data and is not easily estimated by either method. -L Specify the desired norm as 1 or 2, or use -L or -L3 to see both solutions. OPTIONS
xyfile ASCII [or binary, see -b] file containing lon,lat [lat,lon] values in the first 2 columns. If no file is specified, fitcircle will read from standard input. -H Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults file. If used, GMT default is 1 header record. -S Attempt to fit a small circle instead of a great circle. The pole will be constrained to lie on the great circle connecting the pole of the best-fit great circle and the mean location of the data. -V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. -: Toggles between (longitude,latitude) and (latitude,longitude) input/output. [Default is (longitude,latitude)]. Applies to geo- graphic coordinates only. -bi Selects binary input. Append s for single precision [Default is double]. Append n for the number of columns in the binary file(s). [Default is 2 input columns]. EXAMPLES
Suppose you have lon,lat,grav data along a twisty ship track in the file ship.xyg. You want to project this data onto a great circle and resample it in distance, in order to filter it or check its spectrum. Try: fitcircle ship.xyg -L2 project ship.xyg -Cox/oy -Tpx/py -S -pz | sample1d -S-100 -I1 > output.pg Here, ox/oy is the lon/lat of the mean from fitcircle, and px/py is the lon/lat of the pole. The file output.pg has distance, gravity data sampled every 1 km along the great circle which best fits ship.xyg SEE ALSO
gmt(1gmt), project(1gmt), sample1d(1gmt) 1 Jan 2004 FITCIRCLE(l)
All times are GMT -4. The time now is 08:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy