Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using awk to get folder name and date fields with heading Post 302938808 by RudiC on Thursday 19th of March 2015 05:18:17 AM
Old 03-19-2015
Try
Code:
ls -ld wp411* | awk 'BEGIN{printf "%-20s %s\n", "Folder Name", "Date"} {printf "%-20s %s %s %s\n", $9, $6,$7, $8}'

You will need to know the max length of the folder names, though.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Stripping date fields

How would I strip a date field? For example, if I have TODAY defined as the following: TODAY=`date +"%m/%d/%y"`, TODAY is assigned the value 11/01/03 on Nov 1, 2003 How would I strip the first 2 bytes? (11)? Thank you in advance for the help. (6 Replies)
Discussion started by: Latha Nair
6 Replies

2. Shell Programming and Scripting

getting the date fields in Perl

I get the perl date in the following format: Mon Jan 31 06:01:37 2005 How can I extract each field in a single line using a regular expression?? I dont want to use "split". Any other way out?? JP :) (2 Replies)
Discussion started by: jyotipg
2 Replies

3. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

4. Shell Programming and Scripting

Join fields comparing 4 fields using awk

Hi All, I am looking for an awk script to do the following Join the fields together only if the first 4 fields are same. Can it be done with join function in awk?? a,b,c,d,8,,, a,b,c,d,,7,, a,b,c,d,,,9, a,b,p,e,8,,, a.b,p,e,,9,, a,b,p,z,,,,9 a,b,p,z,,8,, desired output: ... (1 Reply)
Discussion started by: aksijain
1 Replies

5. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

6. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

7. UNIX for Dummies Questions & Answers

Sorting on fields for last date

Hi all, I have a file with a list of rpm's that have different dates. I am trying to just grab the latest rpm and install date, and discard the rest. The file has 1000's of entries all with different names and dates. I have tried sort -k on the file and I am not grabbing the info, ... (4 Replies)
Discussion started by: gartie
4 Replies

8. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

9. Shell Programming and Scripting

Delete oldest folder based on folder named as date

Hi, I have a script doing backup to synology server, the script create new folder each day with the date as being folder name i.e. 2018-07-30. Just before creating the new folder I want the script to find the oldest folder from the list and delete it including its content. for example... (3 Replies)
Discussion started by: humble_learner
3 Replies

10. UNIX for Beginners Questions & Answers

UNIX script to replace old date with current date dynamically in multiple files present in a folder

I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with RTG and 3rd column=TD8 I want to substring the date part and I want to replace with currentdate minus 15 days. Here is an example. iam using AIX server $ cat temp.txt RTG*888*TD8*20180201~... (1 Reply)
Discussion started by: Shankar455
1 Replies
OCF_HEARTBEAT_POSTFI(7) 					OCF resource agents					   OCF_HEARTBEAT_POSTFI(7)

NAME
ocf_heartbeat_postfix - Manages a highly available Postfix mail server instance SYNOPSIS
postfix [start | stop | monitor | meta-data | validate-all] DESCRIPTION
This script manages Postfix as an OCF resource in a high-availability setup. SUPPORTED PARAMETERS
binary Full path to the Postfix binary. For example, "/usr/sbin/postfix". (optional, string, default /usr/sbin/postfix) config_dir Full path to a Postfix configuration directory. For example, "/etc/postfix". (unique, optional, string, no default) parameters The Postfix daemon may be called with additional parameters. Specify any of them here. (optional, string, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 20s. stop Stops the resource. Suggested minimum timeout: 20s. reload Suggested minimum timeout: 20s. monitor Performs a detailed status check. Suggested minimum timeout: 20s. Suggested interval: 60s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 20s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. EXAMPLE
The following is an example configuration for a postfix resource using the crm(8) shell: primitive p_postfix ocf:heartbeat:postfix op monitor depth="0" timeout="20s" interval="60s" SEE ALSO
http://www.linux-ha.org/wiki/postfix_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_POSTFI(7)
All times are GMT -4. The time now is 04:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy