How to delete first elements from files?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to delete first elements from files?
# 8  
Old 01-23-2015
Arrays? Files? One-line-files?
# 9  
Old 01-25-2015
files with many lines but i have to make table using first element only.
Moderator's Comments:
Mod Comment There is no sample input, output, nor code in this post. So there shouldn't be any CODE tags.

Last edited by Don Cragun; 01-25-2015 at 03:06 PM.. Reason: Remove extraneous CODE tags.
# 10  
Old 01-25-2015
First element of every file? First element of every line of every file? What are the parentheses in both input and output for?

Why don't you start over, spend a minute or two thinking, and give us a well defined specification with a few, representative sample input files, the logics needed, and the desired output?
# 11  
Old 01-25-2015
In addition to what RudiC has already said...

Please help us help you!

Define your terms! Element could be a byte, a character, a word, a field, a line, a "group" of lines, or any number of other things? What constitutes an "element" in your input files?

You have repeatedly stated that the solutions given read entire files and that this is unacceptable. Why is is unacceptable? How big are your files?

What operating system are you using? Are there any restrictions on the set of tools you can use for this project? What is your preferred shell?

(And, please, use CODE tags to delimit sample input, sample output, and sample code; not entire posts.)
# 12  
Old 01-25-2015
thank you. am sorry i can't make it understandable. i want to make table, out of first element of first line of every input file, input file don't have any brackets elements are separated by a comma(,). and out should be like
Code:
output file={1,1,1}

. output elements should be surround by parentheses({}).

Last edited by Scrutinizer; 01-25-2015 at 03:53 PM.. Reason: rearranged code tags
# 13  
Old 01-25-2015
Please do not leave people guessing. Show a representative sample of input, desired output, attempts at a solution and specify what OS and versions being used, or this thread will be closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

2. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

3. UNIX for Dummies Questions & Answers

Rename multiple files in shell bash, changing elements order.

Hi, I want to rename several files like this: example: A0805120817.BHN A0805120818.BHN ..... to: 20120817.0805.N 20120818.0805.N ...... How can i do this via terminal or in shell bash script ? thanks, (6 Replies)
Discussion started by: pintolcv
6 Replies

4. UNIX for Dummies Questions & Answers

Concatenate files and delete source files. Also have to add a comment.

- Concatenate files and delete source files. Also have to add a comment. - I need to concatenate 3 files which have the same characters in the beginning and have to remove those files and add a comment and the end. Example: cat REJ_FILE_ABC.txt REJ_FILE_XYZ.txt REJ_FILE_PQR.txt >... (0 Replies)
Discussion started by: eskay
0 Replies

5. Shell Programming and Scripting

Need help creating a script to FTP files to a server and then delete the files that were transfered.

I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies

6. Shell Programming and Scripting

PHP: how can I delete empty/NULL elements from a multi-dimensional array.

Hi all I have a file that i'm running and exec(cat ./dat) against..and putting its contents into any array, then doing an exploding the array into a multi-dimension array... The 15 multi-dimensional arrays have elements that are null/empty, I would like to remove/unset these elements and then... (2 Replies)
Discussion started by: zeekblack
2 Replies

7. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

Hello, I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example. file1 ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies

8. Shell Programming and Scripting

Using unset to delete array elements

Hi, I am writing a BASH script. My questions regard deleting elements of arrays. I have an array: michael-browns-powerbook-g4-15:~ msb65$ test_array=(1 2 3 4) michael-browns-powerbook-g4-15:~ msb65$ echo ${test_array} 1 2 3 4 To delete the second element of test_array I type:... (3 Replies)
Discussion started by: msb65
3 Replies

9. Shell Programming and Scripting

Average of elements throught multiple files

Hi, I got a lot of files looking like this: 1 0.5 6 All together there are ard 1'000'000 lines in each of the ard 100 files. I want to build the average for every line, and write the result to a new file. The averaging should start at a specific line, here for example at line... (10 Replies)
Discussion started by: chillmaster
10 Replies

10. Shell Programming and Scripting

find common elements in 2 files (for loop)

Hi, i'm new here (and to scripting too). I was hoping for some help in comparing two files. i have a file called 'file1' with a list of names in the following format: adam jones paul higgins kelly lowe i also have another file which may contain some of the names but with a lot of... (4 Replies)
Discussion started by: ibking
4 Replies
Login or Register to Ask a Question