10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file
file_name_O.txt
The file can have different number of other files names or nothing
I will check
cnt=`wc -l file_name_0.txt`
if ;then
exit 1
fi
Now I have to start checking file names, i.e. read txt file line by line. If amount of ,lines equal 1, I can... (4 Replies)
Discussion started by: digioleg54
4 Replies
2. Shell Programming and Scripting
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 Replies)
Discussion started by: Ferocci
8 Replies
3. Shell Programming and Scripting
Hi all,
I have a file sample.txt
abc
asd
adf
daf
adw
add
adv
wdf
I want to control the number of lines to read
Like if i give input as ./script_name 2 5
required output
asd
adf
daf (2 Replies)
Discussion started by: krux_rap
2 Replies
4. Shell Programming and Scripting
I have one long line text with semicolon used as separator between values in that line. Now, I want to separate the line into multiple line right after every 29th field.
example input line:
... (1 Reply)
Discussion started by: erlanq
1 Replies
5. Shell Programming and Scripting
I have one long line text with semicolon used as separator between values in that line. Now, I want to separate the line into multiple line right after every 29th field.
example input line:
... (2 Replies)
Discussion started by: erlanq
2 Replies
6. UNIX for Dummies Questions & Answers
Hello all,
I'm working on a foreach loop to compare a couple sets of data. However, each datafile includes a header row. I'm wondering if it is possible to tell the foreach loop to skip the first line of data.
I've been using the basic code as follows:
foreach line ("`file.csv`")
set... (2 Replies)
Discussion started by: meteorologistks
2 Replies
7. Shell Programming and Scripting
This script is supposed to display a file ( crontab ), ask the user if they wish to update the file, then it goes through an update routine.
#!/bin/bash
FILE=/etc/crontab
tail -5 $FILE
echo -n "Does crontab need updating"
read HOURS
...routines ....etc...
Runs locally... (8 Replies)
Discussion started by: Bubnoff
8 Replies
8. Shell Programming and Scripting
I am using the while-loop to read a file.
The file has lines with null-terminated strings (words, actually.)
What I have by that reading - just a first word up to '\0'!
I need to have whole string up to 'new line' - (LF, 10#10, 16#A)
What I am doing wrong?
#make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies
9. Shell Programming and Scripting
STEP 1
# Set variable
FILE=/tmp/mainfile
SEARCHFILE =/tmp/searchfile
# THIS IS THE MAIN FILE.
cat /tmp/mainfile
Interface Ethernet0/0 "outside", is up, line protocol is up
Hardware is i82546GB rev03, BW 100 Mbps
Full-Duplex(Full-duplex), 100 Mbps(100 Mbps)
MAC address... (6 Replies)
Discussion started by: irongeekio
6 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I have reached at a specified offset from the start of file. My requirement is that I want to read only those lines, which have the string READ / ALTER / UPDATE. As soon as, none of these literals are found in the subsequent line, I want to stop reading. Is there any feature of grep which... (1 Reply)
Discussion started by: saurabhsinha23
1 Replies