Copy data at specified location from multiple files

Tags
copy, file, files, multiple files, newbies

 
Thread Tools Search this Thread
# 1  
Old 1 Week Ago
Copy data at specified location from multiple files

Hello everyone, Im super new to coding but increasingly in need of it at work. Im have task stacked because of this problems, that I cannot figure out how to solve looking on the internet after trying many many things that looked similar to me.
I have multiple data files of the form (see below).
My question is how can I copy the two columns with the size and rotation data, which is the only one that I need from the file. And then how to do that for several (1000) data files like this.
Thank you very much in advance
Code:
text text       text text text
text texttexttexttext     texttexttext
text text text text text text
X=size
Y_rotation
   45.000000    87.611985 
   47.812500    85.219808 
   42.187500    85.219808 
   45.000000    82.819244 
   50.625000    82.819244 
other text other text  other text
other text

Moderator's Comments:
Mod Comment To keep the forums high quality for all users, please take the time to format your posts correctly.

Please use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the icon that currently looks like </> in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Thank You.

Last edited by Don Cragun; 1 Week Ago at 09:40 PM.. Reason: Add CODE tags and moderator's note.
# 2  
Old 1 Week Ago
Quote:
Originally Posted by Xfiles_fan
Hello everyone, Im super new to coding but increasingly in need of it at work. Im have task stacked because of this problems, that I cannot figure out how to solve looking on the internet after trying many many things that looked similar to me.
I have multiple data files of the form (see below).
My question is how can I copy the two columns with the size and rotation data, which is the only one that I need from the file. And then how to do that for several (1000) data files like this.
Thank you very much in advance
Code:
text text       text text text
text texttexttexttext     texttexttext
text text text text text text
X=size
Y_rotation
   45.000000    87.611985 
   47.812500    85.219808 
   42.187500    85.219808 
   45.000000    82.819244 
   50.625000    82.819244 
other text other text  other text
other text

Moderator's Comments:
Mod Comment To keep the forums high quality for all users, please take the time to format your posts correctly.

Please use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the icon that currently looks like </> in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Thank You.
Hi Xfiles_fan,
Welcome to the UNIX.com forums.

When starting a new thread here, please always tell us what operating system and shell you're using. Various utilities behave differently are different BSD-, Linux-, and UNIX-systems and various shells provide features that do not appear in all shells. If we don't know what environment you're working in, we are likely to make suggestions that work fine for some of us, but won't work in your environment.

Please show us in (Code tags) what you have tried and explain what parts of that worked for you and what parts fell short.

Are the lines that you have shown us in your example:
Code:
X=size
Y_rotation

literal text, or is the X= literal text and the size a place holder for a numeric string. And, is it really an underscore character in Y_rotation or should it also be an equals sign? And is the rotation literal text or a place holder for another numeric string.

Could either of those lines appear elsewhere in what you have shown in your example as text and othertext? Could lines you have shown as text in your example ever start (possibly following leading spaces or tabs) with a numeric character?

Exactly what output are you hoping to produce from the example you have shown us?

Can multiple occurrences of the tabular data you have shown us appear in a single file? If so, how should that affect the output you want?
These 2 Users Gave Thanks to Don Cragun For This Post:
Neo (1 Week Ago) Xfiles_fan (1 Week Ago)

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Copying the files in to multiple location using shell script venkat918 Shell Programming and Scripting 2 4 Weeks Ago 06:54 AM
Copy files based on specific word in a file name & its extension and putting it in required location prajaktaraut Shell Programming and Scripting 13 10-24-2016 08:43 AM
Use find with cp and sed in ksh to copy files to a slightly different location ejianu Shell Programming and Scripting 12 10-20-2016 05:47 PM
Read multiple text files and copy data to csv lp.descamps Shell Programming and Scripting 30 04-05-2016 06:34 PM
How to count successfully copy files source to target location with check directory in Linux? sravanreddy Post Here to Contact Site Administrators and Moderators 0 07-23-2015 05:28 AM
How to copy files from one location to another using xargs?? Saidul Shell Programming and Scripting 6 04-28-2014 02:24 AM
Copy files from one location to another Saidul Shell Programming and Scripting 4 01-11-2014 08:09 AM
How to copy files from one location to another based on a priority? vikramgk9 Shell Programming and Scripting 4 10-19-2013 03:36 AM
how to copy files and record original file location? willie8605 UNIX for Dummies Questions & Answers 4 04-16-2012 03:49 PM
Copy files in thumbnail folder to a secondary location for Amazon S3 Buzzman25 Shell Programming and Scripting 4 01-24-2012 05:17 AM
How to copy a file from one location to another location? vel4ever Shell Programming and Scripting 1 01-12-2012 05:29 AM
Using AWK: Extract data from multiple files and output to multiple new files Liverpaul09 UNIX for Dummies Questions & Answers 3 10-12-2010 04:59 AM
Replacing text from multiple files at multiple location rudoraj Shell Programming and Scripting 2 05-12-2010 05:16 PM
Shell Script for Copy files from one location to another location allways4u21 Shell Programming and Scripting 2 01-21-2010 04:26 PM
copy files from one location to similar location pharos467 UNIX for Advanced & Expert Users 1 09-21-2008 01:21 PM