Sponsored Content
Top Forums Shell Programming and Scripting Seperate complicated fields with awk Post 302280670 by quirkasaurus on Tuesday 27th of January 2009 11:10:37 AM
Old 01-27-2009
i like the tilde solution, too. even better!

but figured i'd post mine anyways -- hopefully some of the ideas are valuable...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort complicated two fields

Hi experts, I am trying sort command with my data but still not getting the expected results. For example, I have 5 fields data here c,18:12:45,c,c,c d,12:34:34,d,d,d a,13:50:10,a,a,a b,13:50:50,b,b,b a,13:50:50,a,a,a b,14:10:01,b,b,b c,10:12:45,c,c,c I want to get ... (3 Replies)
Discussion started by: lalelle
3 Replies

2. Shell Programming and Scripting

how to awk a data from seperate lines

Hi guys, i have a problem which im hoping you will be able to help me with. I have follwing output :- ------------------------------------------------------------------------------- NSTEP = 407000 TIME(PS) = 43059.000 TEMP(K) = 288.46 PRESS = 0.0 Etot = -2077.4322 ... (2 Replies)
Discussion started by: Mish_99
2 Replies

3. UNIX for Dummies Questions & Answers

awk to seperate a string that has a dash

Hello I have this string XYZ-ABC DFT-ERT QWE-TYU I want to get the part after the dash. how to do that? thanks (2 Replies)
Discussion started by: melanie_pfefer
2 Replies

4. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

5. Shell Programming and Scripting

Awk and duplicate lines - little complicated

So I've got problem which continues on my previous one (from few months ago: unix.com/shell-programming-scripting/171764-delete-duplicate-lines-twist.html ). Good, proven, working solutions for that old problem are those: awk '{cur=$0; gsub(/]/, "", cur); if (!a++) print}'and awk... (2 Replies)
Discussion started by: shadowww
2 Replies

6. Shell Programming and Scripting

Join fields comparing 4 fields using awk

Hi All, I am looking for an awk script to do the following Join the fields together only if the first 4 fields are same. Can it be done with join function in awk?? a,b,c,d,8,,, a,b,c,d,,7,, a,b,c,d,,,9, a,b,p,e,8,,, a.b,p,e,,9,, a,b,p,z,,,,9 a,b,p,z,,8,, desired output: ... (1 Reply)
Discussion started by: aksijain
1 Replies

7. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

8. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

9. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

10. Shell Programming and Scripting

awk to filter file based on seperate conditions

The below awk will filter a list of 30,000 lines in the tab-delimited file. What I am having trouble with is adding a condition to SVTYPE=CNV that will only print that line if CI= must be >.05 . The other condition to add is if SVTYPE=Fusion, then in order to print that line READ_COUNT must... (3 Replies)
Discussion started by: cmccabe
3 Replies
Tcl_TranslateFileName(3tcl)				      Tcl Library Procedures				       Tcl_TranslateFileName(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_TranslateFileName - convert file name to native form and replace tilde with home directory SYNOPSIS
#include <tcl.h> char * Tcl_TranslateFileName(interp, name, bufferPtr) ARGUMENTS
Tcl_Interp *interp (in) Interpreter in which to report an error, if any. const char *name (in) File name, which may start with a "~". Tcl_DString *bufferPtr (in/out) If needed, this dynamic string is used to store the new file name. At the time of the call it should be uninitialized or free. The caller must eventually call Tcl_DStringFree to free up anything stored here. _________________________________________________________________ DESCRIPTION
This utility procedure translates a file name to a platform-specific form which, after being converted to the appropriate encoding, is suitable for passing to the local operating system. In particular, it converts network names into native form and does tilde substitution. However, with the advent of the newer Tcl_FSGetNormalizedPath and Tcl_GetNativePath, there is no longer any need to use this procedure. In particular, Tcl_GetNativePath performs all the necessary translation and encoding conversion, is virtual-filesystem aware, and caches the native result for faster repeated calls. Finally Tcl_GetNativePath does not require you to free anything afterwards. If Tcl_TranslateFileName has to do tilde substitution or translate the name then it uses the dynamic string at *bufferPtr to hold the new string it generates. After Tcl_TranslateFileName returns a non-NULL result, the caller must eventually invoke Tcl_DStringFree to free any information placed in *bufferPtr. The caller need not know whether or not Tcl_TranslateFileName actually used the string; Tcl_Translate- FileName initializes *bufferPtr even if it does not use it, so the call to Tcl_DStringFree will be safe in either case. If an error occurs (e.g. because there was no user by the given name) then NULL is returned and an error message will be left in the inter- preter's result. When an error occurs, Tcl_TranslateFileName frees the dynamic string itself so that the caller need not call Tcl_DStringFree. The caller is responsible for making sure that the interpreter's result has its default empty value when Tcl_TranslateFileName is invoked. SEE ALSO
filename KEYWORDS
file name, home directory, tilde, translate, user Tcl 8.1 Tcl_TranslateFileName(3tcl)
All times are GMT -4. The time now is 05:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy