extract different sections of a file


 
Thread Tools Search this Thread
Top Forums Programming extract different sections of a file
# 1  
Old 06-29-2010
extract different sections of a file

Hi All,
I have a file with the data
Code:
10;20;30;40;50;60;70;80;123;145;156;345

. the output i want is the first fourth sixth elements and everything from there on. How do i achieve this.
# 2  
Old 06-29-2010
Code:
cut -d\; -f1,4,6- infile

This User Gave Thanks to radoulov For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract certain sections of a line

I have a log that looks like below sc.mng_10_Err.20131020_000000.log:NCSSC_MNG_UP_PE_TO_BE : Failed to change dvc_trx_sts from PE to BE for srvtrx: 213323141427349 dvcsfx: 1 sc.mng_4_Err.20131020_000000.log:NCSSC_MNG_UP_PE_TO_BE : Failed to change dvc_trx_sts from PE to BE for srvtrx:... (6 Replies)
Discussion started by: senormarquez
6 Replies

2. Shell Programming and Scripting

Omitting sections of file that contain word

I have a configuration file that contains hundreds of these chunks. Each "chunk" is the section that begins with "define service {" and ends with "}". define service { check_command check_proc!java hostgroup_name service_description ... (5 Replies)
Discussion started by: SkySmart
5 Replies

3. Shell Programming and Scripting

awk removing sections of a file

I have a file that looks liek this (see below). can somebody provide me with and awk or sed command that can take a piece of the file starting from the time to the blank line and put in into another file. For example: How would I get the data from 10:56:11 to the blank line. Two things: ... (5 Replies)
Discussion started by: BeefStu
5 Replies

4. Shell Programming and Scripting

Modify sections of the line in a file

Hello.. I have a line in a file which I have to edit: the line looks like: <!]> Sometimes, the section of the line can have only one entry for cn, or maybe more than 2 like below: <!]> I have a variable which has the following value: CN="(cn=MNO)(cn=XYZ)" I need to replace the part... (4 Replies)
Discussion started by: chiru_h
4 Replies

5. Shell Programming and Scripting

Remove sections of a xml file with sed

I've been trying to remove some lines of a xml file that looks like this: <parent> <child>name1</child> <lots_of_other tags></lots_of_other_tags> </parent> <parent> <child>name2</child> <lots_of_other tags></lots_of_other_tags> </parent> <parent> <child>name3</child> ... (5 Replies)
Discussion started by: viniciusandre
5 Replies

6. Shell Programming and Scripting

Parsing file, yaml file? Extracting specific sections

Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Discussion started by: Rhije
3 Replies

7. Shell Programming and Scripting

Best way to remove sections of text from a file

Greetings! I found this fourm via a google search on "sed expressions". I have a file that contains notices and they are all the same length in lines. For example the file would contains 15 notices, each being 26 lines each. I need some way to eliminate notices that contain a "S" in a particular... (8 Replies)
Discussion started by: cals64
8 Replies

8. Shell Programming and Scripting

extract multiple sections of file

I have a file that I need to parse multiple sections from the file. The file contains multiple lines that start with ST (Abunch of data) Then the file contains multiple lines that start with SE (Abunch of data) SE*30*0001 ST*810*0002 I need all of the lines between and including these.... (6 Replies)
Discussion started by: rgentis
6 Replies

9. UNIX for Advanced & Expert Users

extract multiple sections of a file

I have a file that I need to parse multiple sections from the file. The file contains multiple lines that start with ST (Abunch of data) Then the file contains multiple lines that start with SE (Abunch of data) SE*30*0001 ... (1 Reply)
Discussion started by: rgentis
1 Replies

10. Shell Programming and Scripting

Handle Configuration File with same name of Parameter in multiple Sections

Hi I have a config file with multiple section and a parameter with the same name in each section. I need to read each parameter for distinct section. Parameter = 1 .... Parameter = 2 .... Parameter = 4 .... Tried this: grep -m1 '^*ProcessorsNumber' ServiceBrokerFramework.cfg |... (7 Replies)
Discussion started by: potro
7 Replies
Login or Register to Ask a Question