Sponsored Content
Full Discussion: AWK delimiting
Top Forums Shell Programming and Scripting AWK delimiting Post 27675 by peter.herlihy on Thursday 5th of September 2002 02:04:35 AM
Old 09-05-2002
Maybe a bit more clarity on what you're trying to do here....I took it differently to the others....

first file

name
date
time
time requested
approved

second file

john smith
20020808
12:00PM
12:01PM
Yes

Third File

comment for line 1
comment for line 2
comment for line 3
comment for line 4
comment for line 5



Then paste would work and you can specify your delimiter.
paste -s -d"," file1 file2 file3

Is this what you are after. Careful with awk...as there are spaces in your file and these will be treated as delimiters.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help with delimiting columns with a space

Hi all, i am writting a script to fix some problems we have with data that we need that contains 1000s of records. I have a text file with 3 columns of data. The problem is there should be a space between the end of the first column and the start of the second column. The majority of the data is... (7 Replies)
Discussion started by: borderblaster
7 Replies

2. Shell Programming and Scripting

AWK- delimiting the strings and matching the fields

Hello, I am newbie in awk. I have just started learning it. 1) I have input file which looks like: {4812 4009 1602 2756 306} {4814 4010 1603 2757 309} {8116 9362 10779 } {10779 10121 9193 10963 10908} {1602 2756 306 957 1025} {1603 2757 307} and so on..... 2) In output: a)... (10 Replies)
Discussion started by: kajolo
10 Replies

3. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

4. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

5. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

6. Shell Programming and Scripting

awk command to compare a file with set of files in a directory using 'awk'

Hi, I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files. To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Discussion started by: anandek
10 Replies

7. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

8. Shell Programming and Scripting

delimiting using sed command

Hi, I have an output after performing a grep: FAN and i did awk '{print $2}' it shows: is there a way, by using sed that it will only show output as NO_FAULT without the brackets ? i tried doing sed 's/^*//' but the output is NO_FAULT] with the ] at the... (12 Replies)
Discussion started by: mosies
12 Replies

9. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

10. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies
INSQUE(3P)						     POSIX Programmer's Manual							INSQUE(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
insque, remque - insert or remove an element in a queue SYNOPSIS
#include <search.h> void insque(void *element, void *pred); void remque(void *element); DESCRIPTION
The insque() and remque() functions shall manipulate queues built from doubly-linked lists. The queue can be either circular or linear. An application using insque() or remque() shall ensure it defines a structure in which the first two members of the structure are pointers to the same type of structure, and any further members are application-specific. The first member of the structure is a forward pointer to the next entry in the queue. The second member is a backward pointer to the previous entry in the queue. If the queue is linear, the queue is terminated with null pointers. The names of the structure and of the pointer members are not subject to any special restriction. The insque() function shall insert the element pointed to by element into a queue immediately after the element pointed to by pred. The remque() function shall remove the element pointed to by element from a queue. If the queue is to be used as a linear list, invoking insque(&element, NULL), where element is the initial element of the queue, shall ini- tialize the forward and backward pointers of element to null pointers. If the queue is to be used as a circular list, the application shall ensure it initializes the forward pointer and the backward pointer of the initial element of the queue to the element's own address. RETURN VALUE
The insque() and remque() functions do not return a value. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
Creating a Linear Linked List The following example creates a linear linked list. #include <search.h> ... struct myque element1; struct myque element2; char *data1 = "DATA1"; char *data2 = "DATA2"; ... element1.data = data1; element2.data = data2; insque (&element1, NULL); insque (&element2, &element1); Creating a Circular Linked List The following example creates a circular linked list. #include <search.h> ... struct myque element1; struct myque element2; char *data1 = "DATA1"; char *data2 = "DATA2"; ... element1.data = data1; element2.data = data2; element1.fwd = &element1; element1.bck = &element1; insque (&element2, &element1); Removing an Element The following example removes the element pointed to by element1. #include <search.h> ... struct myque element1; ... remque (&element1); APPLICATION USAGE
The historical implementations of these functions described the arguments as being of type struct qelem * rather than as being of type void * as defined here. In those implementations, struct qelem was commonly defined in <search.h> as: struct qelem { struct qelem *q_forw; struct qelem *q_back; }; Applications using these functions, however, were never able to use this structure directly since it provided no room for the actual data contained in the elements. Most applications defined structures that contained the two pointers as the initial elements and also provided space for, or pointers to, the object's data. Applications that used these functions to update more than one type of table also had the problem of specifying two or more different structures with the same name, if they literally used struct qelem as specified. As described here, the implementations were actually expecting a structure type where the first two members were forward and backward pointers to structures. With C compilers that didn't provide function prototypes, applications used structures as specified in the DESCRIP- TION above and the compiler did what the application expected. If this method had been carried forward with an ISO C standard compiler and the historical function prototype, most applications would have to be modified to cast pointers to the structures actually used to be pointers to struct qelem to avoid compilation warnings. By specifying void * as the argument type, applications do not need to change (unless they specifically referenced struct qelem and depended on it being defined in <search.h>). RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
The Base Definitions volume of IEEE Std 1003.1-2001, <search.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 INSQUE(3P)
All times are GMT -4. The time now is 09:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy