Sponsored Content
Top Forums Shell Programming and Scripting Doubt with rearranging file through awk Post 302732719 by pamu on Monday 19th of November 2012 04:57:54 AM
Old 11-19-2012
try

Code:
awk -v var="$a" 'NR==FNR{if($5 ~ /\//){split($5,a,"/");s=a[1]};next}{
if($0 ~ /NOT ARRIVED YET/){printf ("%8d %15s %60s %10s %10s %5s\n", s,$7,$1,var,$3,$2)}
else { printf ("%8d %15s %60s %10s %10s %5s\n", s,$6,$1,var,$4,$2)}}' file file


Last edited by pamu; 11-19-2012 at 06:17 AM.. Reason: corrected..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

rearranging the data in file (from columnwise to rowwise)

Hi I have one file which is having data like 10201 10202 10205 10206 10207 10208 10209 10210 10211 10213 10215 10801 10802 11406 11415 11422 11426 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11530 11604 11608 11611 11717 11718 11719 11722 11725... (3 Replies)
Discussion started by: reldb
3 Replies

2. UNIX for Dummies Questions & Answers

doubt about awk

i have a file like this: awk.lst smith : sales : 1200 : 2 jones:it:25000 : 2 roger : it : 1500 : 2 ravi | acct | 15000 i have 3 doubts 1) when i say awk -F ":" '$2 ~ /'it'/ {print $0}' awk.lst i am not able to get jones in the ouput , is it because of space issue? 2)how to... (2 Replies)
Discussion started by: soujanya_srk
2 Replies

3. Shell Programming and Scripting

Awk doubt

I have a file sample.txt with the following contents: the following gives output as awk 'NF{s=$0; print s}' sample.txt but, awk 'NF{s=$0}{print s}' sample.txtgives output as why this difference, can someone explain me? (6 Replies)
Discussion started by: royalibrahim
6 Replies

4. Shell Programming and Scripting

awk file reading doubt

Hi, Using this trivial code, I am trying to insert/paste the single column data of a file into the second column (field 2) of a multi-column text file. awk 'FNR==NR {a=$0; next} {$1=$1 OFS a}1' single-column-file multi-column-file Lets consider the single-column-file as 'f2' and multi-column... (1 Reply)
Discussion started by: royalibrahim
1 Replies

5. Shell Programming and Scripting

Rearranging the colums in a tab delimited file

I want to rearrange some of my columns in my dat file; how do i do this using a script Suppose, I have an input file like this: BASENAME STREETTYPE PREFIX SUFFIX HOUSENUMBER BUILDUP ORDER8 ORDER2 ORDER1 ISOCOUNTRYCODE POSTALCODE SILVER LAKE RD NW 1135 NEW BRIGHTON RAMSEY MINNESOTA USA 55112... (4 Replies)
Discussion started by: ramky79
4 Replies

6. Shell Programming and Scripting

Rearranging into new columns (awk?)

Hi experts, I've used several solutions from this forum to delete nonsense and rearrange data in the project file I'm working on. I'm hoping you guys can give me some tips on further rearranging the data (I've seen a few solutions by searching, but one specific item has me stumped, which is only... (5 Replies)
Discussion started by: coryvp
5 Replies

7. Shell Programming and Scripting

Doubt on using AWK

DE_CODE|1{AXXANY}1APP_NAME|2{TELCO}2LOC|NY DE_CODE|1{AXXATX}1APP_NAME|2{TELCO}2LOC|TX DE_CODE|1{AXXABT}1APP_NAME|2{TELCO}2LOC|BT DE_CODE|1{AXXANJ}1APP_NAME|2{TELCO}2LOC|NJ i have out put file like below i have to convert it in the format as below. DE_CODE = AXXANY APP_NAME= TELCO LOC = NY... (4 Replies)
Discussion started by: mail2sant
4 Replies

8. Shell Programming and Scripting

Help with splitting and rearranging a field in awk

Please help! I figured I would take this one to the experts. I'm working with a field that contains contents such as: LastName FirstName For example: Smith John I'm trying to take this field and split it so that it is two separate fields (first name and last name). I then need to print... (5 Replies)
Discussion started by: IX3R0XI
5 Replies

9. Shell Programming and Scripting

Need Help in rearranging the content of a file comma seperated

I have a file with the below content a = test1 b = test2 a = test3 b= test4 c = test6 b = test5 d = test7 d = test9 Need the output to be as follows a = test1,test3 b = test2, test5 c = test6 d = test7, test9 (4 Replies)
Discussion started by: iron_michael86
4 Replies

10. Shell Programming and Scripting

Help with rearranging file with script

Hi Guys I normally do thins with a Windows program but I am trying to rearrange a filename based on delimiters in Ubuntu. Example v017 __ Detective Academy Q #133 Murder in the Village Of Suspension Bridges &&& Part 9.cbz = Detective Academy Q v017 #133 Murder in the Village Of Suspension... (9 Replies)
Discussion started by: itschrisonline
9 Replies
OCF_HEARTBEAT_SQUID(7)						OCF resource agents					    OCF_HEARTBEAT_SQUID(7)

NAME
ocf_heartbeat_Squid - Manages a Squid proxy server instance SYNOPSIS
Squid [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
The resource agent of Squid. This manages a Squid instance as an HA resource. SUPPORTED PARAMETERS
squid_exe This is a required parameter. This parameter specifies squid's executable file. (required, string, no default) squid_conf This is a required parameter. This parameter specifies a configuration file for a squid instance managed by this RA. (required, string, no default) squid_pidfile This is a required parameter. This parameter specifies a process id file for a squid instance managed by this RA. (required, string, no default) squid_port This is a required parameter. This parameter specifies a port number for a squid instance managed by this RA. If plural ports are used, you must specifiy the only one of them. (required, integer, no default) squid_stop_timeout This is an omittable parameter. On a stop action, a normal stop method is firstly used. and then the confirmation of its completion is awaited for the specified seconds by this parameter. The default value is 10. (optional, integer, default 10) debug_mode This is an optional parameter. This RA runs in debug mode when this parameter includes 'x' or 'v'. If 'x' is included, both of STDOUT and STDERR redirect to the logfile specified by "debug_log", and then the builtin shell option 'x' is turned on. It is similar about 'v'. (optional, string, no default) debug_log This is an optional and omittable parameter. This parameter specifies a destination file for debug logs and works only if this RA run in debug mode. Refer to "debug_mode" about debug mode. If no value is given but it's requied, it's made by the following rules: "/var/log/" as a directory part, the basename of the configuration file given by "syslog_ng_conf" as a basename part, ".log" as a suffix. (optional, string, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 60s. stop Stops the resource. Suggested minimum timeout: 120s. status Performs a status check. Suggested minimum timeout: 60. monitor Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval: 10s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a Squid resource using the crm(8) shell: primitive example_Squid ocf:heartbeat:Squid params squid_exe=string squid_conf=string squid_pidfile=string squid_port=integer op monitor depth="0" timeout="30s" interval="10s" SEE ALSO
http://www.linux-ha.org/wiki/Squid_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents 1.0.3 07/05/2010 OCF_HEARTBEAT_SQUID(7)
All times are GMT -4. The time now is 03:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy