Sponsored Content
Top Forums Shell Programming and Scripting Need help on awk script to format a file Post 302896659 by yogesh_jain on Tuesday 8th of April 2014 02:28:10 PM
Old 04-08-2014
Thanks.
I think there is more to it than just the trimming.

In Principle, here is what I need to do - not sure how to write that in awk:

From column 1:
If the # = 1 identify the mfg name
If the # = 2 identify the brand name
If the # = 3 identify the sub-brand name
If the # = 4 identify the form name
If the # = 5 identify the sku no and name

If the script is reading identifer 2 - then fill in the mfg name as captured above (seperated by comma)
If the script is reading identifer 3 - then fill in the mfg name and brand name as captured above (seperated by comma)
If the script is reading identifer 4 - then fill in the mfg name and brand name and sub brand as captured above (seperated by comma)
Do this until a new pattern is identified - i.e. new form, subbrand, brand of mfg and repeat this.

Any suggestions?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Format output using awk in script.

Guys, I have a script which hits the database and pulls the information that I need into files. Now I want to format these files to make them easy to read. The sample format of the file will be like.... <Start_of_File> Header1 .....xsdfsfa...adfa...... Header2 ....afefas .aefaefsdf...... (8 Replies)
Discussion started by: bperl
8 Replies

2. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies

3. Programming

awk script to convert a text file into csv format

hi...... thanks for allowing me to start a discussion i am collecting usb usage details of all users and convert it into csv files so that i can export it into some database.. the input text file is as follows:- USB History Dump by nabiy (c)2008 (1) --- Kingston DataTraveler 130 USB... (2 Replies)
Discussion started by: certteam
2 Replies

4. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

5. Shell Programming and Scripting

Need awk/sed to format a file

My content of source file is as below scr1 a1 scr2 a2 b2 scr3 a3 b3 c3 I need a awk/sed command (to be used in C shell)to format it to something like below scr1 $a1 >file1 scr2 $a2 $b2 >file2 scr3 $a3 $b3 $c3 >file3 (12 Replies)
Discussion started by: animesharma
12 Replies

6. Shell Programming and Scripting

awk to format file

Hello, I shall like using the function awk to modify the contents of the following file: /tmp/conf-1 -sec=sys,rw=lpar1:lpar2:lpar3,access=lpar1:lpar2:lpar3 /tmp/conf-2 -vers=4,sec=sys,rw=lpar4:lpar5:lpar6,access=lpar4:lpar5:lpar6 I need to have the result below towards another file ... (5 Replies)
Discussion started by: khalidou13
5 Replies

7. Shell Programming and Scripting

Changing format of file with awk

Hi all, I have a file that looks like this: Closest words to: manifesto >>>> Closest words to: passport >>>> and I want to reformat this with awk with the following desired result: manifesto 0.99999999999999978, 'manifesto' 0.72008211381623111, 'communiqu\xe9'... (5 Replies)
Discussion started by: owwow14
5 Replies

8. Shell Programming and Scripting

awk Script to format output

Hi all, I'm fairly new to this and learning along the way, so bare with me... I'm trying to format the output from a script to be more read-friendly. The output contains more servers and more processes but for as example it will do: Server: Test1 ... (4 Replies)
Discussion started by: Bobsonm
4 Replies

9. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

10. Shell Programming and Scripting

Format a file using awk

I have a file as below empty May7 noread May8 How can process this file and print as below. neat and clean. Filename Date Created empty May7 noread May8 I tried something with printf before creating the file itself... (3 Replies)
Discussion started by: Tuxidow
3 Replies
ACL_GET_BRAND_NP(3)					   BSD Library Functions Manual 				       ACL_GET_BRAND_NP(3)

NAME
acl_get_brand_np -- retrieve the ACL brand from an ACL entry LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <sys/acl.h> int acl_get_brand_np(acl_t acl, int *brand_p); DESCRIPTION
The acl_get_brand_np() function is a non-portable call that returns the ACL brand for the ACL acl. Upon successful completion, the location referred to by the argument brand_p will be set to the ACL brand of the ACL acl. Branding is an internal mechanism intended to prevent mixing POSIX.1e and NFSv4 entries by mistake. It's also used by the libc to determine how to print out the ACL. The first call to function that is specific for one particular brand - POSIX.1e or NFSv4 - "brands" the ACL. After that, calling function specific to another brand will result in error. RETURN VALUES
The acl_get_brand_np() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The acl_get_brand_np() function fails if: [EINVAL] Argument acl does not point to a valid ACL. SEE ALSO
acl(3), posix1e(3) STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17. HISTORY
POSIX.1e support was introduced in FreeBSD 4.0. The acl_get_brand_np() function was added in FreeBSD 8.0. AUTHORS
The acl_get_brand_np() function was written by Edward Tomasz Napierala <trasz@FreeBSD.org>. BSD
June 25, 2009 BSD
All times are GMT -4. The time now is 02:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy