Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Yank versus control-insert formatting differences? Post 302539842 by FlyingSquirrel on Tuesday 19th of July 2011 02:22:20 AM
Old 07-19-2011
Marshlight,
Not sure of what you meant by paring down the grid size... but here is a easy way to reformat a delimited file (this assumes your data values do not contain embedded comma's in the data, they are just used for separators).

Given your sample data, contained in file "sampledata":
1422,52,1,24.881,-88.113,0,300,293,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
1423,53,1,24.85,-87.766,0,300,293,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0

This example takes the first 5 fields and saves to a new "result" file. Note the delimiter is the comma, the printf command is used... 5 "%s" format strings are used, and you pass the first 5 fields: $1 through $5:

Code:
Code:
awk -F\, '{printf("%s,%s,%s,%s,%s\n",$1,$2,$3,$4,$5)}' samplefile > result

Result file contains:
Code:
1422,52,1,24.881,-88.113
1423,53,1,24.85,-87.766

By adjusting the number of "%s" formats and the field positions you want, you should be able to pare-down the data the way you want.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

yank

This is supposed to be simple to do but I am having a hard time trying to yank 1 line (yy) but creating from it 100 lines. I can do yy then keep hitting . to repeat but it doesn't make sense. I may want to create 1000 lines from the one liner. yy then 99 p doesn't work.... Thanks. I was... (5 Replies)
Discussion started by: giannicello
5 Replies

2. UNIX for Dummies Questions & Answers

CTRL+H versus ^? versus BACKSPACE

Hi Gurus! I recently got my shell account (HP UX v11) created by our sysadmin and am having problem deleting with the backspace key. After doing some reading, I believe I need to enter a custom "STTY..." statement in my profile. Can someone please help me with the correct "STTY" sequence... (3 Replies)
Discussion started by: alan
3 Replies

3. Shell Programming and Scripting

<LF> versus <CR>/<LF>

Hello, Can someone explain how to distinguish a LF character and a CR/LF character in a text file from a shell script. Thanks (1 Reply)
Discussion started by: jerardfjay
1 Replies

4. UNIX for Dummies Questions & Answers

annoying vi yank word + delete all question

Hello when i try to yank word only that looks like this "$$foo$" when i stand with my curser marker on the first char ($) and do in vi : "yw" (yank word) its yanks me only the "$" char when i stand white my curser on "f" its yank's me only "foo" how can i yank all word no matter what... (4 Replies)
Discussion started by: umen
4 Replies

5. UNIX for Dummies Questions & Answers

Yank a column in vi

I have a file which has data in columns. Is there a way to yank columns in vi? I tried searching in this forum. I did not find it. Please help me out. (2 Replies)
Discussion started by: stevelrf
2 Replies

6. UNIX for Advanced & Expert Users

cpio versus cp

I am copying a file system to another one. someone suggest me use find . -print |cpio -pdmv but I think cp -r should do the same thing. Am I right? In addition, by using " find . ", I got all the file names,, why do I have to use the -print option? Thanks a lot! (1 Reply)
Discussion started by: fredao
1 Replies

7. Shell Programming and Scripting

^M in yank but not in file in Vim

I am trying to visually select a section of text in vim and then substitute for it using the :%s/ sequence. First I visually select text. Then I yank using "ay. Then I type :%s/ followed by Control R and the register name, in this case a. This fills in the text I have visually selected into... (6 Replies)
Discussion started by: Enobarbus37
6 Replies

8. Shell Programming and Scripting

Differences between 2 Flat Files and process the differences

Hi Hope you are having a great weeknd !! I had a question and need your expertise for this : I have 2 files File1 & File2(of same structure) which I need to compare on some columns. I need to find the values which are there in File2 but not in File 1 and put the Differences in another file... (5 Replies)
Discussion started by: newbie_8398
5 Replies

9. Shell Programming and Scripting

insert LF and TAB for formatting

trying to insert a LF and 2 TABs for this: sed 's/<td><\/td>/<td>\n\t\t<\/td>/' infile. but, I'm not getting the syntax for inserting the LF and TABs correct (1 Reply)
Discussion started by: dba_frog
1 Replies

10. Shell Programming and Scripting

Formatting file data to another file (control character related)

I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve. The source file is compose of many lines with such format: T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE ... (3 Replies)
Discussion started by: hk6279
3 Replies
atlantis(6x)							XScreenSaver manual						      atlantis(6x)

NAME
atlantis - draw swimming sharks, whales, and dolphins. SYNOPSIS
atlantis [-display host:display.screen] [-visual visual] [-window] [-root] [-whalespeed number] [-delay number] [-size number] [-count num- ber] [-no-texture] [-gradient] [-wireframe] [-fps] DESCRIPTION
This is xfishtank writ large: a GL animation of a number of sharks, dolphins, and whales. The swimming motions are great. OPTIONS
-visual visual Specify which visual to use. Legal values are the name of a visual class, or the id number (decimal or hex) of a specific visual. -window Draw on a newly-created window. This is the default. -root Draw on the root window. -whalespeed number Whale Speed. 0 - 1000. Default: 250. -cycles number Shark Speed. Default: 100. -size number Shark Proximity. 100 - 10000. Default: 6000. -count number Number of Sharks. 0 - 20. Default: 4. -texture | -no-texture Whether to show shimmering water. -gradient Whether to draw a gradient on the background, making it darker at the bottom. -wireframe Render in wireframe instead of solid. -fps Display the current frame rate, CPU load, and polygon count. ENVIRONMENT
DISPLAY to get the default host and display number. XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. SEE ALSO
X(1), xscreensaver(1) COPYRIGHT
Copyright (C) 2002 by Mark Kilgard. Permission to use, copy, modify, distribute, and sell this software and its documentation for any pur- pose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any pur- pose. It is provided "as is" without express or implied warranty. AUTHOR
Mark Kilgard. X Version 11 5.15 (28-Sep-2011) atlantis(6x)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy