Sponsored Content
Top Forums Shell Programming and Scripting help with grep command or other useful command Post 302158789 by ghostdog74 on Wednesday 16th of January 2008 09:25:56 AM
Old 01-16-2008
Quote:
Originally Posted by ennstate
I have got an clumpsy solution,Please try,

Code:
awk '{  split($4,LatD,"-");Deg=LatD[1];Dec=LatD[2];sum=(Deg+Dec/60.0);split($5,LonD,"-");LDeg=LonD[1];LDec=LonD[2];Long=(LDeg+LDec/60.0);print $1,$2,$3,sum,Long,$6,$7,$8,$9,$10,$11,$12,$13,$14}' /tmp/YourInputFile

Thanks
Nagarajan G
Its only clumsy when you lump them up into one long mess. anyway, its not a competition for one-liners Smilie
Code:
awk '{  
    split($4,LatD,"-")
    Deg=LatD[1]
    Dec=LatD[2]
    sum=(Deg+Dec/60.0)
    split($5,LonD,"-")
    LDeg=LonD[1]
    LDec=LonD[2]
    Long=(LDeg+LDec/60.0)
    print $1,$2,$3,sum,Long,$6,$7,$8,$9,$10,$11,$12,$13,$14}
    ' /tmp/YourInputFile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep command

Hi, how to search all occurance of keyword in current directory files and sub folder's files also using grep command. thanks (2 Replies)
Discussion started by: avadhani
2 Replies

2. UNIX for Advanced & Expert Users

how to exclude the GREP command from GREP

I am doing "ps -f" to see my process. but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude # ps -f UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies

3. Shell Programming and Scripting

Help me on Grep Command

Hi, Can anybody explain me about the below mentioned code. grep "^" $FILENAME | cut -c 1-8,84- | awk '{ if (!($2+$3)) printf $1 "," }' >$TEMP_FILENAME Thanks in advance. (3 Replies)
Discussion started by: Kattoor
3 Replies

4. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

5. Shell Programming and Scripting

Grep Command

Hi, I Want to grep the 500th character of a line in a file. please help on this. Thanks in advance (7 Replies)
Discussion started by: raghulshekar
7 Replies

6. UNIX for Dummies Questions & Answers

grep command - help

I need to find the word "who" in a file but only that word. For instance I don't want it to find the word "whoever." Any suggestions? (2 Replies)
Discussion started by: brooksie91
2 Replies

7. Shell Programming and Scripting

Help with using grep command with copy command

Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while I've been trying to do: cp... (6 Replies)
Discussion started by: Critical jeff
6 Replies

8. Shell Programming and Scripting

help with grep command

i have a file which lists the following T2323 T3445 T67666,T6534,T4546 T7878 i need to extract the numeric part only(ie,without T). i tried this script awk '{print substr($0,2,length($0))}' pmt2.txtOutput 2323 3445 67666,T6534,T4546as u can see the numbers coming after "," remains the... (2 Replies)
Discussion started by: born
2 Replies

9. Shell Programming and Scripting

help with grep command

i have the following lines T2345 T3435 - bugfixed and running T5654 fixed and committed T34541:- fixed and committed i need to extract only the T part (eg:T2345) ,ie i dont want any special characters after it. i have been trying with grep and egrep but with no luck. pls help (11 Replies)
Discussion started by: born
11 Replies

10. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies
textutil::split(n)				    Text and string utilities, macro processing 				textutil::split(n)

__________________________________________________________________________________________________________________________________________________

NAME
textutil::split - Procedures to split texts SYNOPSIS
package require Tcl 8.2 package require textutil::split ?0.7? ::textutil::split::splitn string ?len? ::textutil::split::splitx string ?regexp? _________________________________________________________________ DESCRIPTION
The package textutil::split provides commands that split strings by size and arbitrary regular expressions. The complete set of procedures is described below. ::textutil::split::splitn string ?len? This command splits the given string into chunks of len characters and returns a list containing these chunks. The argument len defaults to 1 if none is specified. A negative length is not allowed and will cause the command to throw an error. Providing an empty string as input is allowed, the command will then return an empty list. If the length of the string is not an entire multiple of the chunk length, then the last chunk in the generated list will be shorter than len. ::textutil::split::splitx string ?regexp? This command splits the string and return a list. The string is split according to the regular expression regexp instead of a simple list of chars. Note that if you parentheses are added into the regexp, the parentheses part of separator will be added into the result list as additional element. If the string is empty the result is the empty list, like for split. If regexp is empty the string is split at every character, like split does. The regular expression regexp defaults to "[\t \r\n]+". BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category textutil of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. SEE ALSO
regexp(n), split(n), string(n) KEYWORDS
regular expression, split, string CATEGORY
Text processing textutil 0.7 textutil::split(n)
All times are GMT -4. The time now is 09:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy