I'm trying something hard (for me) to create a report script,normally the following script works:
Echos are just for cosmetic touch,
Output:
I need to add up extra field to output as "OFFER NAME"
this output will come from 14th field of input files (pipe seperated) after stripping them by using SED and when I run the following command it works; it fetches what I want:
gives something like:
Desired Outout is :
However when I want to add it to the whole command above it fails
I though I had to use a system command (but i'm not sure)
could you please suggest/correct the command?
I tried (did not show echoes part; its already confusing):
I believe I don't need sprintf as it prints the stripped string..
I wanna use a system function to deal with several data. So I use awk variable FILENAME to transfer the file directory to system command, but it does not work.
I use a shell function "out_function" to deal with data and save the result in another directory with the same file name.
How can I... (2 Replies)
I am using Sun Solaris 5.8
I am trying to run a system command such as ls and echo inside awk, but when I run the following code system echo is not displayed.
bash-2.03$ ls | awk 'BEGIN {
print "first print"
system("echo system echo")
print "second print"
... (1 Reply)
I was trying commands within awk. i got stuck here. i take 2 files.
cat input
first
second
third
fourth
fifth
sixth
seventh
eighth
ninht
tenthcat add
***************
Nirbhay
***************i run the command
awk '{ if ( NR == 5 ) { print system("cat add") "\n" $0 } else {... (4 Replies)
Hi,
When i use the system( ) function inside a awk, i am getting the ouput with a 0 appended in a new line.
Can someone guide me to eliminate the extra line containing 0.
Ex :
awk -F"|" '{print system("convert.sh" $1}'
The output is displayed with 0 in a new line.
... (8 Replies)
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)
dear All,
my awk system command isn't working or rather I'm missing something in my command. Appreciated , if anyone can assist me what exactly I'm missing ??
awk ' /^/ {
> c=split($3,a,"/") ;for(n=1; n<=c; ++n)
> {
> if (system("test -d" /home/cubedata/20120104/"$1"/"a")) {
> print... (5 Replies)
Hi,
I was searching for a way to grep 2 lines before and after a certain keyword, and I came across the following code..
awk "\$0 ~ /ORA-/ {
cmd=\"awk 'NR>=\" NR-2 \" && NR<=\" NR+2 \"' init.ora\"
system(cmd)
}" input_file
I could not understand how this works. What is system() ? what... (2 Replies)
Hi
I need your help, please
How can I pass arguments to system command in a awk script?... for example:
byte=substr(cadena,pos,2);
system("grep -n byte mapeo.txt");
Does it exist a way?
Thanks for advance. (4 Replies)
Hi,
I have around 10 files in a folder in which I want to change the file format from tab(\t) to pipe(|) with some changes in the fields as well. Below is the code, while tmp file is getting generated but move command is not working, please help
Following is the code
awk -F"\t" '{print... (2 Replies)
Hi,
Trying to join 2 files with awk (file1 has variable number of fields; file 2 has constant number of fields)
file1:
hook1|AA|BB|CC|DD
hook2|EE|FF
file2:
hook1|11|22
hook2|33|44
hook3|55|66
output:
hook1|11|22|AA|BB|CC|DD
hook2|33|44|EE|FF
hook3|55|66
What I tried so far:... (3 Replies)