Allignment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Allignment
# 8  
Old 08-03-2009
you didn't use code tags hence I couldn't figure out the syntax possibilities.

anyways,

if you are using solaris, then try /usr/xpg4/bin/awk or nawk

and check if it works.
# 9  
Old 08-03-2009
Hi Anchal,

I used nawk and was getting the below error:

nawk: syntax error at source line 1
context is
>>> = <<<
nawk: bailing out at source line 1


Thanks,
Shazin
# 10  
Old 08-03-2009
do you have spaces around the "=" ??

Code:
awk -v something=something

if yes, please remove.
# 11  
Old 08-03-2009
Hi Anchal,

That was the problem, but now am getting the below error.

nawk: can't open file {if (NR >(total_records - 2)) printf "\t%s\n", $0; else print $0}
source line number 1

Best Regards,
Shazin
# 12  
Old 08-03-2009
I still doubt you have space.
please double check that there is no space in anyside of "=".

check and if fails, post the command with code tags.
# 13  
Old 08-03-2009
Please find the code that I am using:

Code:
nawk -v total_records=$(cat redirects.virgin-atlantic.com.conf | wc -l) '{if(NR>(total_records - 2)) printf "\t%s\n", $0; else print $0}' redirects.virgin-atlantic.com.conf

---------- Post updated at 02:19 PM ---------- Previous update was at 02:18 PM ----------

Code:
nawk -v total_records=$(cat redirects.virgin-atlantic.com.conf | wc -l) '{if(NR>(total_records - 2)) printf "\t%s\n", $0; else print $0}' redirects.virgin-atlantic.com.conf

# 14  
Old 08-03-2009
it is working with me.

Code:
$bash$:-> awk -v total_records=$(cat redirects.virgin-atlantic.com.conf | wc -l) '{if(NR>(total_records - 2)) printf "\t%s\n", $0; else print $0}' redirects.virgin-atlantic.com.conf

Code:
ceName: Node-1
processName: tzMgmt
Status: PROCESS_NOT_RUNNING
ceName: Node-2
processName: tzMgmt
Status: PROCESS_RUNNING
ceName: Node-1
processName: XDM
Status: PROCESS_NOT_RUNNING
ceName: Node-2
        processName: XDM
        Status: PROCESS_RUNNING

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Allignment input file

Guys, I have a requirement as below 36%/ 55%/var 82%/tmp 74%/opt now i want the output to be --------------------------------- Disk% Mount --------------------------------- 36% / 55% var 82% tmp 74% opt ---------------------------------------- I have used... (3 Replies)
Discussion started by: AraR87
3 Replies

2. Shell Programming and Scripting

awk - script help: column to row format of data allignment?

Experts Good day, I have the following data, file1 BRAAGRP1 A2X B2X C2X D2X BRBGRP12 A3X B3X Z10 D09 BRC1GRP2 LO01 (4 Replies)
Discussion started by: rveri
4 Replies

3. Shell Programming and Scripting

Output allignment

Hi Guys, I hope you are doing good out there. I am facing some issues in the alligment of the output of a shell script. Below is the statement which is formatting the output:echo $File | awk -F '' '{print $13,$15="\t"$16,$4="",$5,$6,$7}' and its output is Domain Log file ... (2 Replies)
Discussion started by: singh.chandan18
2 Replies

4. Shell Programming and Scripting

Text allignment using PERL

Hi Friends, For daily reports i make perl script like below. @dirlist = `cat out.txt |cut -d "|" -f1 >create.txt`; @dirlist1 = `cat out.txt|wc -l *e* >create2.txt`; open FILE, ">OUTPUT.txt"; @command = `cat out.txt |cut -d "|" -f1`; print FILE map{$_-2 ."\n"}@command; @dirlist2 =... (1 Reply)
Discussion started by: adaleru
1 Replies

5. Shell Programming and Scripting

linux 'paste' allignment problem

Hi Everyone, # cat 1 #!/usr/bin/perl print "c\tc\t\n"; # cat 2 #!/usr/bin/perl print "b\tb\t\n"; print "b\tb\t\n"; print "b\tb\t\n"; # perl 1 > 11 # perl 2 > 22 # cat 11 c c # cat 22 b b b b b b # paste 11 22 (5 Replies)
Discussion started by: jimmy_y
5 Replies

6. Shell Programming and Scripting

Allignment of lines in a file

Hi All, I am using the below scrit to insert lines in a file: #!/bin/ksh # To delete the last line if it contains the pattern Redirect permanent / Virgin Atlantic Airways - Popup echo "Enter the URL that should point to the particular microsite" read url # To delete the last line if it... (2 Replies)
Discussion started by: Shazin
2 Replies
Login or Register to Ask a Question

Featured Tech Videos