Sponsored Content
Top Forums Shell Programming and Scripting Need help writing array for the specific need of shell script Post 302909305 by JITHENDER on Wednesday 16th of July 2014 05:06:08 AM
Old 07-16-2014
Sorry for not mention clearly. I say it is example which i wrote here.
I need shell script to extract 3,5,7 which are in every 4th row for the below example.
==============
Code:
03
03
03
03
05
05
05
05
07
07
07
07

I am using Linux bash shell.. I don't know array concept in shell scripting i just know basics of shell programming.
I tried using
Code:
cut -f 1,4

and
Code:
cut -f 1,8

but it doesn't get the exact location.

---------- Post updated at 02:36 PM ---------- Previous update was at 02:06 PM ----------

Quote:
Originally Posted by Don Cragun
Is this a homework assignment?

I'm completely confused about what you are trying to do. You have shown us a file that contains 12 or 13 lines (I had to guess when I added CODE tags for you whether or not the line containing the equal signs is part of your input file). Then you say that you want every 50th row (of which there are none). And then you say you want 3, 5, and 7 (none of which appear in your input file). And you say you want those values stored in an array. What kind of array (shell, awk, ???)?

What OS are you using?

What shell are you using?

What language are you using?

What have you tried?
Sorry for not mention clearly. I say it is example which i wrote here.
I need shell script to extract 3,5,7 which are in every 4th row for the below example.
==============
Code:
03
03
03
03
05
05
05
05
07
07
07
07

I am using Linux bash shell.. I don't know array concept in shell scripting i just know basics of shell programming.
I tried using
Code:
cut -f 1,4

and
Code:
cut -f 1,8

but it doesn't get the exact location and also i wanted to store it in array after extracting it.

Last edited by JITHENDER; 07-17-2014 at 05:16 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with writing shell script

I have the following output. I want to write a script to check for 1. waits > 0 on all rowsand Ratio > .0. if true then send email. ========================= ROLLBACK SEGMENT CONTENTION ========================= If any ratio is > .01 then more rollback segments are needed NAME ... (1 Reply)
Discussion started by: jigarlakhani
1 Replies

2. Shell Programming and Scripting

Need help for writing shell script

Hello ALL, I am fresher in Unix . i need help to write small shell script . Please help me unix guru. I am developing the internal site in my office . the data files are generated in one directory everyday . I have to write shell script to sort those files and put it is internal site . ... (3 Replies)
Discussion started by: deepa20
3 Replies

3. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

4. Shell Programming and Scripting

Writing shell script

Hi, I am a new for shell script. i need to write script using the following commands cd /usres/test # create directory mkdir temp+DATE( i need to append date ) #moving files from one directory to this directory(we need to check total files in source and taget) cd /users/sample ... (2 Replies)
Discussion started by: bmkreddy
2 Replies

5. UNIX for Dummies Questions & Answers

can anybody help me out in writing the script for incrementing the specific field

can anybody help me out in writing the any script (awk,shell or perl script) for incrementing the specific field highlighted below /{/data/{/assetMetricsList//{1]/dailyCount,........./{/data/{/assetMetricsList//{100]/dailyCount It should be in below format in oneline seperated by commas ... (1 Reply)
Discussion started by: swapnak
1 Replies

6. Shell Programming and Scripting

Need help in writing the shell script

Can anyone please help me in writing a shell script that would check if a particular user(xyz) has logged in, and if yes, the audit daemon needs to be started. When the user logs off the dameon needs to shutdown , and the report needs to be e-mailed to a set of users. (12 Replies)
Discussion started by: ggayathri
12 Replies

7. Shell Programming and Scripting

help writing rm script excluding specific titled dir

I am attempting to write a housecleaning script that does the following: 1) goes to a specific directory 2) deletes all contents of that directory but a specific directory within it. So my users all keep and use the Shared directory in OSX. Within /Users/Shared there are also standard named... (1 Reply)
Discussion started by: nomados
1 Replies

8. Shell Programming and Scripting

Need help in writing a script to create a new text file with specific data from existing two files

Hi, I have two text files. Need to create a third text file extracting specific data from first two existing files.. Text File 1: Format contains: SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010 some text ............so on...and somwhere text like: Record 1:... (1 Reply)
Discussion started by: shashi143ibm
1 Replies

9. Shell Programming and Scripting

Need help writing shell script!

Hi, I'm very new to this, so bear with me please. I want to write a sh script (or if there's a better format please let me know) that allows me to, when I run it, print the date to a file (1.out) take 2 arguments (files a.fa and b.fa), run them with another program, outputting to 2.out, and then... (2 Replies)
Discussion started by: ShiGua
2 Replies

10. UNIX for Dummies Questions & Answers

Need help writing shell script!

Hi, I'm very new to this, so bear with me please. I want to write a sh script (or if there's a better format please let me know) that allows me to, when I run it, print the date to a file (1.out) take 2 arguments (files a.fa and b.fa), run them with another program, outputting to 2.out, and then... (4 Replies)
Discussion started by: ShiGua
4 Replies
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy