Sponsored Content
Full Discussion: Help in creating a text file
Top Forums Shell Programming and Scripting Help in creating a text file Post 302536298 by itkamaraj on Tuesday 5th of July 2011 04:08:50 AM
Old 07-05-2011
Code:
 
$ nawk ' { if (NR%5==1) {base=$0;printf("form meta from dev %s,config=striped;\n",$0);for(i=0;i<3;i++){getline;printf("add dev %s to meta %s;\n",$0,base);}}}' inputfile

form meta from dev 0772,config=striped;
add dev 0ECC to meta 0772;
add dev 0FC8 to meta 0772;
add dev 1080 to meta 0772;
form meta from dev 1081,config=striped;
add dev 1082 to meta 1081;
add dev 1083 to meta 1081;
add dev 1084 to meta 1081;
form meta from dev 1085,config=striped;
add dev 1086 to meta 1085;
add dev 1087 to meta 1085;
add dev 1088 to meta 1085;
form meta from dev 1089,config=striped;
add dev 1159 to meta 1089;
add dev 115A to meta 1089;
add dev 115B to meta 1089;
form meta from dev 115C,config=striped;
add dev 115D to meta 115C;
add dev 115E to meta 115C;
add dev 115F to meta 115C;
form meta from dev 1160,config=striped;
add dev 1161 to meta 1160;
add dev 1162 to meta 1160;
add dev 1163 to meta 1160;
form meta from dev 1164,config=striped;
add dev 1165 to meta 1164;
add dev 1166 to meta 1164;
add dev 1167 to meta 1164;
form meta from dev 116A,config=striped;
add dev 116B to meta 116A;
add dev 116C to meta 116A;
add dev 116D to meta 116A;

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Creating flat text file (ASCII)

Hi everybody. I need help and I hope someone is willing to help me out here. My wholesale company is currently moving to new software. The old software is running on a UNIX platform. We need to migrate data from the UNIX system, but our former software provider refuses to assist the data... (5 Replies)
Discussion started by: Wdonero
5 Replies

2. Shell Programming and Scripting

Creating a text file in Local Drive

Hi All, I am new in Shell Script. I have a ksh script running in the Unix Server and basically in that script I need to create a text file but the text file has to be generated in the local PC (the user computer such as in C:\ drive). I have no idea on how to do it and I need it pretty urgently.... (2 Replies)
Discussion started by: yramli
2 Replies

3. Homework & Coursework Questions

creating search script for a text file

I am aware of the stipulations regarding homework, however I am completely stuck and do not know how to even begin the following (in bash): Create a script that searches for a text file with most occurrences of a given keyword. Any help is greatly appreciated. Thank you (1 Reply)
Discussion started by: hybridoutlaw
1 Replies

4. Shell Programming and Scripting

Help with creating a text file in perl with file creation date.

Hi, I am quite new to Perl scripting and i need to create a .TXT file using perl, with fields (A,B,C,D,E), and this text file should be named with current file creation date "XYZ_CCYYMMDD.TXT" (i.e.XYZ_2011042514:33 PM). Can anyone who has done this, please share their expertise on this... (5 Replies)
Discussion started by: msrahman
5 Replies

5. UNIX for Dummies Questions & Answers

creating text file with content from script

hi, can somebody tell me how I can create a text file with content from Bash script. The file should be prefilled with information such as current date and time then leaving the user ability to input more data right below those prefilled content. thank you :) (0 Replies)
Discussion started by: s3270226
0 Replies

6. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

7. Shell Programming and Scripting

Help for reformatting text file and creating new format

Hi all, I have an input file like 1,date,company,, 1,date,comapny,, 2,000,,,567,ACT,00,,,,KKG,M1,D45,,67J,+4500000000 2,000,,,567,ACT,00,,,,KKG,M6,D49,,56J,+6000 2,000,,,567,ACT,00,,7,,KKG,M3,D58,,68h,-70000 2,000,,,567,ACT,00,,,,KKG,M9,D95,,34m,0.00 3,total what i require is 1.I... (2 Replies)
Discussion started by: selvankj
2 Replies

8. Shell Programming and Scripting

Creating a new file with each line of a text file

Hello, I would like to make a script in c-shell, using sed comand, but i don know how to do this task: I have a file name data in /home/user/IMPUT with several text lines: 1144088 2012/05/21 23:20:08 36.8505 -11.2618 0 4.3(mb) 1143593 2012/05/18 13:12:12 34.0526 ... (3 Replies)
Discussion started by: tenteyu
3 Replies

9. Shell Programming and Scripting

crontab not creating text file

while running the following code in ssh crontab, Its running successfully but its not creating text file IFC1.txt, file1.txt, file2.txt while running manually its working. please help me #!/bin/ksh hostname > file1.txt 2>/dev/null hostname >> file1.txt 2>/dev/null sudo df -h | grep... (2 Replies)
Discussion started by: elango963
2 Replies

10. Shell Programming and Scripting

Creating new users using a text file as imput (using only shell script and/or awk)

I need somebody who could help with an exercise. You have a text file called users.txt with this info inside: users.txt: user1:1234:/home/homedir1 ; user2:1234:/home/homedir2 ; user3:1234:/home/homedir3 ; user4:1234:/home/homedir4 ; The script should create an user using the... (2 Replies)
Discussion started by: marcosruiz
2 Replies
ucblinks(1B)					     SunOS/BSD Compatibility Package Commands					      ucblinks(1B)

NAME
ucblinks - adds /dev entries to give SunOS 4.x compatible names to SunOS 5.x devices SYNOPSIS
/usr/ucb/ucblinks [-e rulebase] [-r rootdir] DESCRIPTION
ucblinks creates symbolic links under the /dev directory for devices whose SunOS 5.x names differ from their SunOS 4.x names. Where possi- ble, these symbolic links point to the device's SunOS 5.x name rather than to the actual /devices entry. ucblinks does not remove unneeded compatibility links; these must be removed by hand. ucblinks should be called each time the system is reconfiguration-booted, after any new SunOS 5.x links that are needed have been created, since the reconfiguration may have resulted in more compatibility names being needed. In releases prior to SunOS 5.4, ucblinks used a nawk rule-base to construct the SunOS 4.x compatible names. ucblinks no longer uses nawk for the default operation, although nawk rule-bases can still be specifed with the -e option. The nawk rule-base equivalent to the SunOS 5.4 default operation can be found in /usr/ucblib/ucblinks.awk. OPTIONS
-e rulebase Specify rulebase as the file containing nawk(1) pattern-action statements. -r rootdir Specify rootdir as the directory under which dev and devices will be found, rather than the standard root directory /. FILES
/usr/ucblib/ucblinks.awk sample rule-base for compatibility links ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
devlinks(1M), disks(1M), ports(1M), tapes(1M), attributes(5) SunOS 5.10 13 Apr 1994 ucblinks(1B)
All times are GMT -4. The time now is 08:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy