Newbye. Help with KSH. Loop in files and remove first line
Hi everybody. Firstly, sorry for doing such a basic questions, but i have never worked with linux shells and at this moment i am trully desperated :d.
I have been checkin' another posts of this forum looking for different things for mixing them and get the solution to my problem, but i have not been yet able to reach something that works.
My problem is that i have to do a ksh script for processing all the files in a directory given, remove the first line for each of them, saving them with the same name (but i'm so desperated that i will save them with another name too ).
For example, the /home/bringer/test/files directory has the following files:
input1.txt
input2.txt
input3.txt
...
input99.txt
and i want to remove the first line for each of them. I have the following script, but it doesn' work
I'm really stucked and i don't know the right with to continue. May anybody give me any clues?
It works great, but i'm trying something different:
I have taken your sample and added the possibility to give it the directory by standard input, but after call it with this "ksh ejemplo2.ksh /home/bringer/test/ficheros" i get this:
Quote:
Just before ls 11111
Inside
sed: error reading from /home/bringer/test/ficheros/: it's a directory
mv: «/home/bringer/test/ficheros/.tmp» and «/home/bringer/test/ficheros/.tmp» are the same file
Hecho
I have a test file with the following format, It contains the username_date when the user was locked from the database.
$ cat lockedusers.txt
TEST1_21062016
TEST2_02122015
TEST3_01032016
TEST4_01042016
I'm writing a ksh script and faced with this difficult scenario for my... (11 Replies)
Good Afternoon,
I start with a file named biglist.txt.
I have another file smallerlist. txt
I want to remove the lines from smallerlist.txt from biglist.txt and leave those lines that do not reside in smallerlist.txt.
Thanks !! (2 Replies)
Hi ,
I'm using Ksh 88 version.
I've a text file which contains the directory names
DIR1
DIR2
----
DIR10
I've to remove the data which has more that 30 days from the above directories .
The data has to be removed from the following path
cd /home/etc/DIR1/hist
cd /home/etc/DIR2/hist... (2 Replies)
hi
i want to scp files from remote server B to my local server A...
and i have a file containing list of all files to be scped from remote server B
there is a passwordless connectivity set between remote server and my local server.
need a ksh script.. with a for loop that goes through... (2 Replies)
How to remove the first line from multiple files and use it as source to the jobs. Only at the runtime it should remove the first line not in the file . (1 Reply)
Hello!
I need to realize such task.
1. In my user's home dir I have folder1;
2. In folder1 I have some (various count) subfolders with random names;
3. In these subfolders I have one file anyname.pdf (various name in each subfolder) and file content.txt (constant name in each subfolder)
##... (7 Replies)
Hi
I have 3 files and I want to remove 1 line in each file. This line correposnds to the occurrence of a specific pattern
any idea how to do this in shell?
thx (4 Replies)
Hi All,
Working on AIX 5.3
we need to remove '^M' in each line of files.
could anyone please share such an experience would be appreciated.
Thanks for your time!
Regards, (9 Replies)
How would I go about storing multiple file paths in a directory that begin like: 20080402*
and run a loop that reads each line of each file thats in a given directory. So far this is what I have:
#!/bin/ksh
echo "ENTER Reprint Date (YYYYMMDD): "
read ReprintDate
echo ""... (1 Reply)
I want to remove the first line of all files in a directory with .dat extension. Can any one help me on this with a small script. I want the file names to remain same . (8 Replies)