Grabbing Certain Fields


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grabbing Certain Fields
# 1  
Old 11-04-2010
Grabbing Certain Fields

ok, so a script i wrote spits out an output like the below:


Code:
2,JABABA,BV=114,CV=1,DF=-113,PCT=99.1228%


as you can see, each field is separated by a comma. now, how can I get rid of the first field and ONLY show the rest of the fields.

meaning,

i want to get rid of the "2,", and only show every thing else that comes after that. the reason why this is difficult for me is that the first field isn't always a "2,". the numbers can and do change.
# 2  
Old 11-04-2010
Narrative: sed, at the beginning of the line, substitute for not-comma-characters and comma with nothing.
Code:
 
sed 's/^[^,]*,//'

# 3  
Old 11-04-2010
Code:
cat output | cut -d"," -f2-

# 4  
Old 11-04-2010
same as above
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grabbing fields without using external commands

data: bblah1_blah2_blah3_blah4_blah5 bblahA_blahB_blahC_blahD_blahE im using the following code to grab the field i want: cat data | while IFS='_' read v1 v2 v3 v4 v5; do printf '%s\n' "${v4}"; done im catting data here. in the real world, the exact content of data will be in a variable.... (4 Replies)
Discussion started by: SkySmart
4 Replies

2. Shell Programming and Scripting

Grabbing variabes from logs

Hey guys, I am working on a script that needs to grab variables from a log file. The script will run morning 9 to 5pm and save variables for each run every hour, these results I will be aggregating at the end of the day. I am thinking I will be placing the date on each entry in the log every... (7 Replies)
Discussion started by: mo_VERTICASQL
7 Replies

3. Shell Programming and Scripting

Grabbing fields with perl

I have several .csv files containing data like this: field_1;field_2;date;comment;amount; I want to extract the 3 last fields and load them in a database. my input_file = "/dir/file.csv"; my output_file = "/dir/file.sql"; open my $csv_file, '<', $input_file or die "Can't... (1 Reply)
Discussion started by: freddie50
1 Replies

4. Shell Programming and Scripting

Grabbing strings with awk

Hello everyone, I am doing some sort of analysis for some data about organic solvents, and I have a problem with writing a command to do this: Here's a sample of my file: 1 ethanol 2 methanol 3 methanol/ethanol 4 ethanol/methanol 5 ethanol/DMF 6 ethyl... (6 Replies)
Discussion started by: Error404
6 Replies

5. Shell Programming and Scripting

Kornshell grabbing value from file

I have a script right now that I run a command which outputs just one word to a file. Well I need to grab that value and use it in another line of code so... touch oraclesid.txt echo $ORACLE_SID > oraclesid.txt #grab that value sqlplus v500/v500@<value> how do I grab that value from the... (6 Replies)
Discussion started by: Blogger11
6 Replies

6. Shell Programming and Scripting

Grabbing and printing only first number

I'm having quite a time figuring this one out. I want to print only the first number (n digits). So with this input: Title 1 2* the thing of it 3 more words 4 some more *5 what? 6 more and more *7 I love it 8* boom! 9 it's *8 still here 10 22 23 1 2134 4 2343 32 23 4 44 ... (7 Replies)
Discussion started by: jjgarcia310
7 Replies

7. Shell Programming and Scripting

Grabbing info from Telnet

I have a process that is running locally on the machine. When you telnet to the process: telnet IP port, it automatically returns a string which shows the status of that process. Something like this: # telnet IP Port Trying 127.0.0.1... Connected to localhost (127.0.0.1). Escape... (3 Replies)
Discussion started by: skaptakalian
3 Replies

8. Shell Programming and Scripting

Grabbing URL's from a website

Hi everyone, Need your help creating a script that downloads a website after entering the URL e.g. Google, and parses its contents for URL's and appends the output to a text file in this format: http://grabbed-url-from-downloaded-website.com/ http://another-url-from-downloaded-website.com/ ... (3 Replies)
Discussion started by: ogoy
3 Replies

9. UNIX for Dummies Questions & Answers

Grabbing a value from an output file

I am executing a stored proc and sending the results in a log file. I then want to grab one result from the output parameters (bolded below, 2) so that I can store it in a variable which will then be called in another script. There are more details that get printed in the beginning of the log file,... (3 Replies)
Discussion started by: hern14
3 Replies

10. Shell Programming and Scripting

Grabbing variables and comparing

I have two computers with dynamic IP addresses and am using dyndns so that they are identifiable as the same computer even if their IPs change (we'll call them host1.dyndns.com and host2.dyndns.com). I also have a remote server which I would like to store my computers' IP addresses on. There is a... (9 Replies)
Discussion started by: kerpm
9 Replies
Login or Register to Ask a Question