Sponsored Content
Full Discussion: awk pipes & print
Top Forums Shell Programming and Scripting awk pipes & print Post 302168906 by Jonny2Vests on Tuesday 19th of February 2008 05:44:17 PM
Old 02-19-2008
Quote:
Originally Posted by ynixon
try this

Code:
awk '/phrase/ {print $1,$2,$3 ; system("command "$1)}' file

Thanks guys and thanks for this ynixon, which is quite elegant and what I was looking for. I'm using:

awk '/phrase/ {system("command "$1" ");print $3" "$4}' file > output

...the only problem is the ; forces a new line. Any way around that?

Jon
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

PIPEs and Named PIPEs (FIFO) Buffer size

Hello! How I can increase or decrease predefined pipe buffer size? System FreeBSD 4.9 and RedHat Linux 9.0 Thanks! (1 Reply)
Discussion started by: Jus
1 Replies

2. Shell Programming and Scripting

Multiple pipes toward a single awk command

Hello, I would like to pipe two variables into awk, but I don't know how to do. Each variable, "a" and "b", are in fact a list of data. They are not files. So to get awk to work with it I am using: echo $a | awk 'FNR==NR{print $1}FNR!=NR{print $4}' The above works, but when I am... (5 Replies)
Discussion started by: jolecanard
5 Replies

3. Shell Programming and Scripting

awk modify multiple columns with pipes

Hello, I have a CSV-like dataset where some of the columns contain HTML snippets which I need to convert to XHTML. For any given snippet, I have a functioning config for the text processor 'tidy' such that tidy -config tidy.cfg example.html does the job I need done. I would like to process... (10 Replies)
Discussion started by: bstamper
10 Replies

4. Shell Programming and Scripting

awk: Multiple search patterns & print in an one liner

I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}' Can anybody help getting the right code? (10 Replies)
Discussion started by: sdf
10 Replies

5. Programming

C++ socket, fork & pipes

Hello, I'm stuck and this is a matter which I need to resolve quite fast (but I couldn't post in the "Emergency" section); the problem is this : I have created a chat program in which the client sends the sentence to the server and then the server should send it to all the clients connected,... (2 Replies)
Discussion started by: timmyyyyy
2 Replies

6. Shell Programming and Scripting

awk Help: Filter Multiple Entry & print in one line.

AWK Gurus, data: srvhcm01 AZSCI srvhcm01 AZSDB srvhcm01 BZSDB srvhcm01 E2QDI31 srvhcm01 YPDCI srvhcm01 YPDDB srvhcm01 UV2FSCR srvhcm01 UV2FSBI srvhcm01 UV2FSXI srvhcm01 UV2FSUC srvhcm01 UV2FSEP srvhcm01 UV2FSRE srvhcm01 NASCI srvhcm01 NASDB srvhcm01 UV2FSSL srvhcm01 UV2FSDI (7 Replies)
Discussion started by: rveri
7 Replies

7. Shell Programming and Scripting

awk question: How to print condition of NR & NF together.

Experts: LINE1 :This is line one The FIRST line of the file. LINE2 :This is line two LINE3 :This is line three with 8 fileds LINE4 :This is line four LINE5 :This is line five LINE6 :This is line six with 8 fileds I want to delete line 1, and then process the file and want to print lines... (2 Replies)
Discussion started by: rveri
2 Replies

8. UNIX for Dummies Questions & Answers

How to create a print filter that print text & image?

Currently, I have a print filter that takes a text file, that convert it into PCL which then gets to a HP printer. This works. Now I need to embedded a image file within the text file. I'm able to convert the image file into PCL and I can cat both files together to into a single document... (1 Reply)
Discussion started by: chedlee88-1
1 Replies

9. Shell Programming and Scripting

awk to find and replace Double quotes between pipes

Hello, Need a AWK command to find and replace Double Quotes in Pipe delimited files Actully its a CSV file converted to Pipe but the double quotes still exists. So i want to Get rid of them. Example Input 1|2|3|sadsad|"Abc Efg 3"""|dada Output 1|2|3|sadsad|Abc Efg 3"|dada Thanks... (5 Replies)
Discussion started by: krux_rap
5 Replies

10. Shell Programming and Scripting

How to print & and \n while replacing with sed/awk?

string="din&esh\nisgood" File.txt: the name is sed "s#\#${string}#g" File.txt Output am getting: the name is dinesh is good Expected output: the name is din&esh\nisgood The input string is dynamic it will be keep on changing am able to handle & by placing \& in the string.. (5 Replies)
Discussion started by: dineshaila
5 Replies
JOCAML(1)						      General Commands Manual							 JOCAML(1)

NAME
jocaml - The JoCaml interactive toplevel SYNOPSIS
jocaml [ -unsafe ] [ -I lib-dir ] [ object-files ] [ script-file ] DESCRIPTION
The jocaml(1) command is the toplevel system for JoCaml, that permits interactive use of the JoCaml system through a read-eval-print loop. In this mode, the system repeatedly reads Caml phrases from the input, then typechecks, compiles and evaluates them, then prints the inferred type and result value, if any. The system prints a # (sharp) prompt before reading each phrase. A toplevel phrase can span several lines. It is terminated by ;; (a double-semicolon). The syntax of toplevel phrases is as follows. The toplevel system is started by the command jocaml(1). Phrases are read on standard input, results are printed on standard output, errors on standard error. End-of-file on standard input terminates jocaml(1). If one or more object-files (ending in .cmo or .cma ) are given, they are loaded silently before starting the toplevel. If a script-file is given, phrases are read silently from the file, errors printed on standard error. jocaml(1) exits after the execution of the last phrase. OPTIONS
The following command-line options are recognized by jocaml(1). -I directory Add the given directory to the list of directories searched for source and compiled files. By default, the current directory is searched first, then the standard library directory. Directories added with -I are searched after the current directory, in the order in which they were given on the command line, but before the standard library directory. -unsafe Turn bound checking off on array and string accesses (the v.(i) and s.[i] constructs). Programs compiled with -unsafe are therefore slightly faster, but unsafe: anything can happen if the program accesses an array or string outside of its bounds. ENVIRONMENT VARIABLES
LC_CTYPE If set to iso_8859_1, accented characters (from the ISO Latin-1 character set) in string and character literals are printed as is; otherwise, they are printed as decimal escape sequences. TERM When printing error messages, the toplevel system attempts to underline visually the location of the error. It consults the TERM variable to determines the type of output terminal and look up its capabilities in the terminal database. SEE ALSO
jocamlc(1). The Objective Caml user's manual, chapter "The toplevel system". JOCAML(1)
All times are GMT -4. The time now is 09:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy